Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

OSGi multi field creation

manikanthar1295
Level 4
Level 4

Hi,

 

I have create one OSGi Configuration in that i have 3 Fields

I need 3rd Field as multifield how we can make Field as multifield in OSGI Configuration.

 

1 Accepted Solution
BrianKasingli
Correct answer by
Community Advisor
Community Advisor

@manikanthar1295,

Please refer to this OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide, during the development of your OSGI configurations, https://sourcedcode.com/blog/aem/osgi-r6-configuration-attributedefinition-essentials-reference-guid...

This will allow you to quickly craft together your OSGI configs in no time.

Something like this would initiate a String[]

 @AttributeDefinition(
name = "String[] Label",
description = "String[] Config Example Description",
type = AttributeType.STRING)
String[] config_string_array_example() default {"item1", "item2"};

BrianKasingli_0-1625055969424.png

 

View solution in original post

0 Replies
Ritesh_Mittal
Community Advisor
Community Advisor

Hi @manikanthar1295 ,

 

The below thread will help you-

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-create-a-osgi-confi...

 

In your OCD, it should be like this-

 

@AttributeDefinition(name = "My prop", description = "Multi values")
String[] getMyPropValues();

Bhuwan_B
Community Advisor
Community Advisor

@manikanthar1295  Please refer to Set and Get OSGI Configuration values using Multifield section of below article URL:

https://aem4beginner.blogspot.com/create-custom-osgi-configuration-in-aem

 

Bimmi_Soi
Community Advisor
Community Advisor

Hi @manikanthar1295 

 

Just declare as String[] rather than String in your java class(Object Class definition).

 

@AttributeDefinition(name = "Custom Config", description = "Custom Config description")
String[] getCustomConfig();

 

 

Hope this helps!

Thanks

 

 

 

BrianKasingli
Correct answer by
Community Advisor
Community Advisor

@manikanthar1295,

Please refer to this OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide, during the development of your OSGI configurations, https://sourcedcode.com/blog/aem/osgi-r6-configuration-attributedefinition-essentials-reference-guid...

This will allow you to quickly craft together your OSGI configs in no time.

Something like this would initiate a String[]

 @AttributeDefinition(
name = "String[] Label",
description = "String[] Config Example Description",
type = AttributeType.STRING)
String[] config_string_array_example() default {"item1", "item2"};

BrianKasingli_0-1625055969424.png

 

View solution in original post