1 package org.hibernate.hql; 3 4 import org.hibernate.persister.collection.CollectionPropertyNames; 5 6 import java.util.HashMap ; 7 import java.util.Map ; 8 9 14 public final class CollectionProperties { 15 public static final Map HQL_COLLECTION_PROPERTIES; 16 17 private static final String COLLECTION_INDEX_LOWER = CollectionPropertyNames.COLLECTION_INDEX.toLowerCase(); 18 19 static { 20 HQL_COLLECTION_PROPERTIES = new HashMap (); 21 HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_ELEMENTS.toLowerCase(), CollectionPropertyNames.COLLECTION_ELEMENTS ); 22 HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_INDICES.toLowerCase(), CollectionPropertyNames.COLLECTION_INDICES ); 23 HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_SIZE.toLowerCase(), CollectionPropertyNames.COLLECTION_SIZE ); 24 HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_INDEX.toLowerCase(), CollectionPropertyNames.COLLECTION_MAX_INDEX ); 25 HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_INDEX.toLowerCase(), CollectionPropertyNames.COLLECTION_MIN_INDEX ); 26 HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MAX_ELEMENT.toLowerCase(), CollectionPropertyNames.COLLECTION_MAX_ELEMENT ); 27 HQL_COLLECTION_PROPERTIES.put( CollectionPropertyNames.COLLECTION_MIN_ELEMENT.toLowerCase(), CollectionPropertyNames.COLLECTION_MIN_ELEMENT ); 28 HQL_COLLECTION_PROPERTIES.put( COLLECTION_INDEX_LOWER, CollectionPropertyNames.COLLECTION_INDEX ); 29 } 30 31 private CollectionProperties() { 32 } 33 34 public static boolean isCollectionProperty(String name) { 35 String key = name.toLowerCase(); 36 if ( COLLECTION_INDEX_LOWER.equals( key ) ) { 38 return false; 39 } 40 else { 41 return HQL_COLLECTION_PROPERTIES.containsKey( key ); 42 } 43 } 44 45 public static String getNormalizedPropertyName(String name) { 46 return ( String ) HQL_COLLECTION_PROPERTIES.get( name ); 47 } 48 49 public static boolean isAnyCollectionProperty(String name) { 50 String key = name.toLowerCase(); 51 return HQL_COLLECTION_PROPERTIES.containsKey( key ); 52 } 53 } 54 | Popular Tags |