Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

OSGi multi field creation

Avatar

Level 6

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

Avatar

Correct answer by
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

4 Replies

Avatar

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();

Avatar

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

 

Avatar

Employee 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

 

 

 

Avatar

Correct answer by
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