1 19 package org.apache.cayenne.access.types; 20 21 import java.lang.reflect.Constructor ; 22 23 import org.apache.cayenne.util.Util; 24 25 31 class EnumTypeFactory implements ExtendedTypeFactory { 32 33 private Constructor enumTypeConstructor; 34 35 EnumTypeFactory() { 36 37 try { 39 Class enumTypeClass = Util 40 .getJavaClass("org.apache.cayenne.access.types.EnumType"); 41 enumTypeConstructor = enumTypeClass.getConstructor(new Class [] { 42 Class .class 43 }); 44 } 45 catch (Throwable th) { 46 } 48 } 49 50 public ExtendedType getType(Class objectClass) { 51 if (enumTypeConstructor == null) { 52 return null; 53 } 54 55 try { 56 ExtendedType type = (ExtendedType) enumTypeConstructor 58 .newInstance(new Object [] { 59 objectClass 60 }); 61 62 return type; 63 } 64 catch (Throwable th) { 65 return null; 67 } 68 } 69 } 70 | Popular Tags |