@@ -25,30 +25,30 @@ public enum CollectionClassification {
2525 * An Object or primitive array. Roughly follows the semantics
2626 * of {@link #LIST}
2727 */
28- ARRAY ( PluralAttribute . CollectionType . COLLECTION , true ) ,
28+ ARRAY ,
2929
3030 /**
3131 * A non-unique, unordered collection. Represented
3232 * as {@link java.util.Collection} or {@link java.util.List}
3333 */
34- BAG ( PluralAttribute . CollectionType . COLLECTION , false ) ,
34+ BAG ,
3535
3636 /**
3737 * A {@link #BAG} with a generated id for each element
3838 */
39- ID_BAG ( PluralAttribute . CollectionType . COLLECTION , false ) ,
39+ ID_BAG ,
4040
4141 /**
4242 * A non-unique, ordered collection following the requirements of {@link java.util.List}
4343 *
4444 * @see org.hibernate.cfg.AvailableSettings#DEFAULT_LIST_SEMANTICS
4545 */
46- LIST ( PluralAttribute . CollectionType . LIST , true ) ,
46+ LIST ,
4747
4848 /**
4949 * A unique, unordered collection following the requirements of {@link java.util.Set}
5050 */
51- SET ( PluralAttribute . CollectionType . SET , false ) ,
51+ SET ,
5252
5353 /**
5454 * A sorted {@link #SET} using either natural sorting of the elements or a
@@ -58,7 +58,7 @@ public enum CollectionClassification {
5858 * @see org.hibernate.annotations.SortNatural
5959 * @see org.hibernate.annotations.SortComparator
6060 */
61- SORTED_SET ( PluralAttribute . CollectionType . SET , false ) ,
61+ SORTED_SET ,
6262
6363 /**
6464 * A {@link #SET} that is ordered using an order-by fragment
@@ -69,12 +69,12 @@ public enum CollectionClassification {
6969 * @see jakarta.persistence.OrderBy
7070 * @see org.hibernate.annotations.SQLOrder
7171 */
72- ORDERED_SET ( PluralAttribute . CollectionType . SET , false ) ,
72+ ORDERED_SET ,
7373
7474 /**
7575 * A collection following the semantics of {@link java.util.Map}
7676 */
77- MAP ( PluralAttribute . CollectionType . MAP , true ) ,
77+ MAP ,
7878
7979 /**
8080 * A sorted {@link #MAP} using either natural sorting of the keys or a
@@ -84,7 +84,7 @@ public enum CollectionClassification {
8484 * @see org.hibernate.annotations.SortNatural
8585 * @see org.hibernate.annotations.SortComparator
8686 */
87- SORTED_MAP ( PluralAttribute . CollectionType . MAP , true ) ,
87+ SORTED_MAP ,
8888
8989 /**
9090 * A {@link #MAP} that is ordered using an order-by fragment
@@ -95,22 +95,22 @@ public enum CollectionClassification {
9595 * @see jakarta.persistence.OrderBy
9696 * @see org.hibernate.annotations.SQLOrder
9797 */
98- ORDERED_MAP ( PluralAttribute .CollectionType .MAP , true );
99-
100- private final PluralAttribute .CollectionType jpaClassification ;
101- private final boolean isIndexed ;
102-
103- CollectionClassification (PluralAttribute .CollectionType jpaClassification , boolean isIndexed ) {
104- this .jpaClassification = jpaClassification ;
105- this .isIndexed = isIndexed ;
106- }
98+ ORDERED_MAP ;
10799
108100 public PluralAttribute .CollectionType toJpaClassification () {
109- return jpaClassification ;
101+ return switch ( this ) {
102+ case ARRAY , BAG , ID_BAG -> PluralAttribute .CollectionType .COLLECTION ;
103+ case LIST -> PluralAttribute .CollectionType .LIST ;
104+ case SET , SORTED_SET , ORDERED_SET -> PluralAttribute .CollectionType .SET ;
105+ case MAP , SORTED_MAP , ORDERED_MAP -> PluralAttribute .CollectionType .MAP ;
106+ };
110107 }
111108
112109 public boolean isIndexed () {
113- return isIndexed ;
110+ return switch ( this ) {
111+ case ARRAY , LIST , MAP , SORTED_MAP , ORDERED_MAP -> true ;
112+ default -> false ;
113+ };
114114 }
115115
116116 public boolean isRowUpdatePossible () {
0 commit comments