OSGi multi field creation | Community
Skip to main content
manikanthar1295
June 30, 2021
Solved

OSGi multi field creation

  • June 30, 2021
  • 4 replies
  • 1779 views

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.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by BrianKasingli

@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-guide#attribute-type-string-array

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"};

 

4 replies

Ritesh_Mittal
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
June 30, 2021

Hi @manikanthar1295 ,

 

The below thread will help you-

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-create-a-osgi-configuration-holding-multi-dimensional/qaq-p/364495

 

In your OCD, it should be like this-

 

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

Bhuwan_B
Community Advisor
Community Advisor
June 30, 2021

@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

 

Adobe Employee
June 30, 2021

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
Community Advisor and Adobe Champion
BrianKasingliCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
June 30, 2021

@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-guide#attribute-type-string-array

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"};