cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Difference between hybris enum value v/s java given enum?

Former Member

Accepted Solutions (0)

Answers (1)

Answers (1)

Hari_prasad
Participant
0 Kudos

Hybris enum can be dynamic whereas java enum is fixed

Also you can add values to dynamic enum in runtime but in java enum, it is not possible

 <enumtype generate="true" code="NavigationBarMenuLayout"
         autocreate="true" dynamic="true">
         <description>This type determines the position of navigation bar.</description>
         <value code="AUTO" />
         <value code="RIGHT_EDGE" />
         <value code="LEFT_EDGE" />
     </enumtype>

set dynamic=true to make enum as dynamic

Former Member
0 Kudos

Hi ,

How can we add dynamic enum in runtime ?

Thanks,

Venki

sduvvuri
Explorer
0 Kudos

Hi Venkateswarlu,

You can add new value for an enum using valueOf method of that particular enum if and only if its dynamic attribute is true. Otherwise you'll get ConsistencyCheckException.

You can refer the below link for more details of how to use enumerations in Hybris.

https://help.hybris.com/6.7.0/hcd/8c895989866910148d6a802f06651702.html

Thanks, .

Former Member
0 Kudos

Hi ,

Can you give sample code snippet by using valueOf() method and what the use case (Real time example ) to build dynamic enums ?

Thanks, Venki