1 10 11 package com.triactive.jdo.store; 12 13 import com.triactive.jdo.ClassNotPersistenceCapableException; 14 import com.triactive.jdo.model.FieldMetaData; 15 import java.lang.reflect.Field ; 16 import javax.jdo.JDOFatalInternalException; 17 import javax.jdo.JDOUnsupportedOptionException; 18 19 20 abstract class FieldTable extends JDOBaseTable 21 { 22 protected final FieldMetaData fmd; 23 protected final Field field; 24 protected final Class ownerType; 25 26 protected FieldTable(TableMetadata tmd, FieldMetaData fmd, StoreManager storeMgr) 27 { 28 super(tmd, storeMgr); 29 30 this.fmd = fmd; 31 this.field = fmd.getField(); 32 this.ownerType = fmd.getClassMetaData().getPCClass(); 33 34 switch (fmd.getPersistenceModifier()) 35 { 36 case FieldMetaData.PERSISTENCE_MODIFIER_NONE: 37 default: 38 throw new JDOFatalInternalException("Invalid persistence modifier on field " + fmd.getName()); 39 40 case FieldMetaData.PERSISTENCE_MODIFIER_TRANSACTIONAL: 41 break; 42 43 case FieldMetaData.PERSISTENCE_MODIFIER_PERSISTENT: 44 break; 45 } 46 } 47 48 49 public Field getField() 50 { 51 return field; 52 } 53 54 55 protected SQLIdentifier getBaseColumnNameForType(Class c) 56 { 57 ClassBaseTable cbt; 58 59 try 60 { 61 cbt = storeMgr.getClassBaseTable(c); 62 } 63 catch (ClassNotPersistenceCapableException e) 64 { 65 cbt = null; 66 } 67 68 if (cbt == null) 69 { 70 String javaName = c.getName(); 71 javaName = javaName.substring(javaName.lastIndexOf('.') + 1); 72 return new ColumnIdentifier(dba, javaName); 73 } 74 else 75 return cbt.getName(); 76 } 77 } 78 | Popular Tags |