1 2 12 package com.versant.core.jdo.sco.detached; 13 14 import com.versant.core.jdo.sco.*; 15 import com.versant.core.metadata.FieldMetaData; 16 import com.versant.core.metadata.MDStaticUtils; 17 import com.versant.core.metadata.MDStatics; 18 19 import com.versant.core.common.BindingSupportImpl; 20 21 24 public class DetachSCOFactoryRegistry { 25 26 29 public VersantSCOFactory getJdoGenieSCOFactory(FieldMetaData fmd) { 30 if (fmd.category == MDStatics.CATEGORY_SIMPLE && fmd.typeCode == MDStatics.DATE) { 31 return new DetachSCODateFactory(); 32 } 33 return null; 34 } 35 36 39 public VersantSCOCollectionFactory getJDOGenieSCOCollectionFactory( 40 FieldMetaData fmd) { 41 if (fmd.category == MDStatics.CATEGORY_COLLECTION) { 42 switch (fmd.typeCode) { 43 case MDStatics.HASHSET: 44 case MDStatics.SET: 45 return new DetachSCOHashSetFactory(); 46 case MDStatics.TREESET: 47 case MDStatics.SORTEDSET: 48 return new DetachSCOTreeSetFactory(); 49 case MDStatics.COLLECTION: 50 case MDStatics.LIST: 51 case MDStatics.ARRAYLIST: 52 return new DetachSCOArrayListFactory(); 53 case MDStatics.LINKEDLIST: 54 return new DetachSCOLinkedListFactory(); 55 56 57 case MDStatics.VECTOR: 58 return new DetachSCOVectorFactory(); 59 60 default: 61 throw BindingSupportImpl.getInstance().notImplemented("Creating a SCO instance for field " + 62 fmd.getName() + " of type " + MDStaticUtils.toSimpleName(fmd.typeCode) + 63 " is not supported"); 64 } 65 } 66 return null; 67 } 68 69 72 public VersantSCOMapFactory getJDOGenieSCOMapFactory(FieldMetaData fmd) { 73 if (fmd.category == MDStatics.CATEGORY_MAP) { 74 switch (fmd.typeCode) { 75 case MDStatics.MAP: 76 case MDStatics.HASHMAP: 77 return new DetachSCOHashMapFactory(); 78 case MDStatics.HASHTABLE: 79 return new DetachSCOHashtableFactory(); 80 case MDStatics.TREEMAP: 81 case MDStatics.SORTEDMAP: 82 return new DetachSCOTreeMapFactory(); 83 default: 84 throw BindingSupportImpl.getInstance().internal("Type code not supported as map. TypeCode = " + 85 MDStaticUtils.toSimpleName(fmd.typeCode)); 86 } 87 } 88 return null; 89 } 90 } 91 | Popular Tags |