public class StoreContainerType {
- public final static int STOC_TYPE_UNKNOWN=0;
- public final static int STOC_TYPE_ENTITY=1;
- public final static int STOC_TYPE_ENTITYLIST=2;
+ public final static int STOC_TYPE_UNKNOWN=0;
+ public final static int STOC_TYPE_ENTITY=1;
+ public final static int STOC_TYPE_ENTITYLIST=2;
- private static HashMap uniqueTypes = new HashMap(); // StoreKey / StoreContainerType
- private static Logfile storeLog;
- private Class stocClass=null;
- private int stocType=STOC_TYPE_UNKNOWN;
+ private static HashMap uniqueTypes = new HashMap(); // StoreKey / StoreContainerType
+ private static Logfile storeLog;
+ private Class stocClass=null;
+ private int stocType=STOC_TYPE_UNKNOWN;
- private StoreContainerType() {}
+ private StoreContainerType() {}
- private StoreContainerType(Class stocClass, int stocType) {
- this.stocClass=stocClass;
- this.stocType=stocType;
- }
+ private StoreContainerType(Class stocClass, int stocType) {
+ this.stocClass=stocClass;
+ this.stocType=stocType;
+ }
- public static StoreContainerType valueOf(Class stoc_class, int stoc_type) {
- /** @todo factory, only gives out types once to make them comparable via ==
- * check if class is StorableObject */
- StoreContainerType returnStocType=null;
+ public static StoreContainerType valueOf(Class stoc_class, int stoc_type) {
+ /** @todo factory, only gives out types once to make them comparable via ==
+ * check if class is StorableObject */
+ StoreContainerType returnStocType=null;
- // inner class for hashlookup
- class StoreKey {
- int storeType;
- Class storeClass;
- }
+ // inner class for hashlookup
+ class StoreKey {
+ int storeType;
+ Class storeClass;
+ }
- StoreKey key = new StoreKey();
- key.storeClass = stoc_class; key.storeType = stoc_type;
- if (uniqueTypes.containsKey(key))
- returnStocType=(StoreContainerType)uniqueTypes.get(key);
- else {
- returnStocType=new StoreContainerType(stoc_class,stoc_type);
- uniqueTypes.put(key,returnStocType);
- }
- return returnStocType;
- }
+ StoreKey key = new StoreKey();
+ key.storeClass = stoc_class; key.storeType = stoc_type;
+ if (uniqueTypes.containsKey(key))
+ returnStocType=(StoreContainerType)uniqueTypes.get(key);
+ else {
+ returnStocType=new StoreContainerType(stoc_class,stoc_type);
+ uniqueTypes.put(key,returnStocType);
+ }
+ return returnStocType;
+ }
- public String toString() {
- StringBuffer sb = new StringBuffer("StoreContainerType: ");
- sb.append(this.stocClass.toString()).append("@");
- sb.append(stringForStoreType(stocType)).append("\n");
- return sb.toString();
- }
+ public String toString() {
+ StringBuffer sb = new StringBuffer("StoreContainerType: ");
+ sb.append(this.stocClass.toString()).append("@");
+ sb.append(stringForStoreType(stocType)).append("\n");
+ return sb.toString();
+ }
- private static String stringForStoreType(int stocType) {
- switch(stocType) {
- case STOC_TYPE_ENTITY: return "ENTITY";
- case STOC_TYPE_ENTITYLIST: return "ENTITYLIST";
- default: return "UNKNOWN";
- }
- }
+ private static String stringForStoreType(int stocType) {
+ switch(stocType) {
+ case STOC_TYPE_ENTITY: return "ENTITY";
+ case STOC_TYPE_ENTITYLIST: return "ENTITYLIST";
+ default: return "UNKNOWN";
+ }
+ }
}
\ No newline at end of file