Showing results for 
Search instead for 
Did you mean: 

How to define an ordered relation with the CollectionType SortedSet

Former Member
0 Kudos

Based on hybris documentation there should be a SortedSet for ordered relations:

CollectionTypes are based on the Java Collection class. Via the type attribute in a CollectionType's definition, you can make use of the Collection class and some of its subclasses (List, Set, and SortedSet). A Collection is a list of elements. A List is a number of ordered items. Although there may be equal items in a List, the items' order is relevant. Items in a List may be accessed by an index counter. A Set is an unordered number of items that must all be unique, no two items may be equal. A SortedSet is the combination ot a List and a Set. It contains a number of ordered items that must all be unique.

The items definition of the sourceElement looks like this:

 <sourceElement type="ClassAttributeAssignment" qualifier="namegenClassAttributeAssignments"
     cardinality="many" collectiontype="list" ordered="true">

I would expect to get a SortedSet, but the return type but i get:

 private Set<ClassAttributeAssignmentModel>

How to get a SortedSet?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

That is just the declaration of the attribute, hybris internally uses LinkedHashSet if you specify ordered="true".