OSGi multi field creation

Avatar

Avatar
Affirm 1
Level 3
manikanthar1295
Level 3

Likes

7 likes

Total Posts

85 posts

Correct reply

1 solution
Top badges earned
Affirm 1
Validate 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Affirm 1
Level 3
manikanthar1295
Level 3

Likes

7 likes

Total Posts

85 posts

Correct reply

1 solution
Top badges earned
Affirm 1
Validate 25
Give Back 10
Give Back 5
Give Back 3
View profile
manikanthar1295
Level 3

30-06-2021

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.

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Establish
MVP
BrianKasingli
MVP

Likes

645 likes

Total Posts

607 posts

Correct reply

239 solutions
Top badges earned
Establish
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
BrianKasingli
MVP

30-06-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-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

 

Answers (3)

Answers (3)

Avatar

Avatar
Affirm 25
Level 5
Bimmi_Soi
Level 5

Likes

73 likes

Total Posts

81 posts

Correct reply

26 solutions
Top badges earned
Affirm 25
Contributor
Applaud 5
Boost 50
Ignite 1
View profile

Avatar
Affirm 25
Level 5
Bimmi_Soi
Level 5

Likes

73 likes

Total Posts

81 posts

Correct reply

26 solutions
Top badges earned
Affirm 25
Contributor
Applaud 5
Boost 50
Ignite 1
View profile
Bimmi_Soi
Level 5

30-06-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

 

 

 

Avatar

Avatar
Affirm 50
Level 6
Bhuwan_B
Level 6

Likes

133 likes

Total Posts

125 posts

Correct reply

50 solutions
Top badges earned
Affirm 50
Give Back 5
Boost 100
Give Back 3
Affirm 25
View profile

Avatar
Affirm 50
Level 6
Bhuwan_B
Level 6

Likes

133 likes

Total Posts

125 posts

Correct reply

50 solutions
Top badges earned
Affirm 50
Give Back 5
Boost 100
Give Back 3
Affirm 25
View profile
Bhuwan_B
Level 6

30-06-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

 

Avatar

Avatar
Boost 5
Level 7
Ritesh_M
Level 7

Likes

179 likes

Total Posts

142 posts

Correct reply

44 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Boost 5
Level 7
Ritesh_M
Level 7

Likes

179 likes

Total Posts

142 posts

Correct reply

44 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile
Ritesh_M
Level 7

30-06-2021

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