|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.SubclassProviderImpl
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.IntegerSubclassProvider
SubclassProvider implementation that uses an integer as
a subclass indicator value in the database rather than the full
classname. This requires that a class-to-integer mapping be
specified in the metadata for the types that use this subclass
provider.
These mappings are specified as demonstrated in the following
example, in which rows representing
com.acme.object.Foo have a value of 1
stored in the JDOCLASSX column, and rows representing
com.acme.object.Bar have a value of 2:
]]>
This class should probably be refactored to allow for easier extension for non-integer subclass indicator values. But for now, that task is left as an exercise for the reader.
| Field Summary | |
static String |
INDICATOR_VALUE
The JDO metadata extension key under which the integer indicator value is stored. |
| Fields inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.SubclassProviderImpl |
CLASS_COL |
| Constructor Summary | |
IntegerSubclassProvider()
|
|
| Method Summary | |
protected String |
getClassName(Object val)
Return the String name of the class corresponding to val, or null if no mapping exists
for val. |
protected int |
getIndicatorColumnSQLType()
Returns the SQLTypes type constant for the indicator
column used by this mapping/provider combination. |
Class |
getType(PersistenceManagerImpl pm,
ClassResolver resolver,
Object indicatorVal)
Return a Class object given that val was stored
in this mapping's indicator column. |
Object |
getValue(PersistenceManagerImpl pm)
Return an object to be stored in this mapping's indicator column. |
protected void |
initialize(ClassMapping cm)
Ensure that an integer value is specified for this class mapping. |
void |
initialize(ClassMapping cm,
Column[] cols)
Intercept the initialization routines so we can extract a reference to the class mapping and do some validation. |
void |
initialize(ClassMapping cm,
Table primaryTable)
Intercept the initialization routines so we can extract a reference to the class mapping and do some validation. |
protected void |
registerSubclassMapping(Class cls,
Object val)
Register the mapping from cls to
val. |
| Methods inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.SubclassProviderImpl |
addClassCondition, addClassCondition, addSubclassConditions, addSubclassConditions, getIndicatorColumnName, getIndicatorColumns, getSubclasses, getType, insert, select, select |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final String INDICATOR_VALUE
subclass-indicator-value.| Constructor Detail |
public IntegerSubclassProvider()
| Method Detail |
public void initialize(ClassMapping cm,
Table primaryTable)
initialize in class SubclassProviderImpl
public void initialize(ClassMapping cm,
Column[] cols)
initialize in class SubclassProviderImplprotected void initialize(ClassMapping cm)
public Class getType(PersistenceManagerImpl pm,
ClassResolver resolver,
Object indicatorVal)
SubclassProviderImplval was stored
in this mapping's indicator column. The class should be loaded
with resolver. pm is a reference to
the PersistenceManagerImpl that requested that this class
be loaded.getType in class SubclassProviderImplpublic Object getValue(PersistenceManagerImpl pm)
SubclassProviderReturn an object to be stored in this mapping's indicator
column. pm is a reference to the
PersistenceManagerImpl that requested that this class be
loaded.
This method should generate values from which
SubclassProvider.getType(PersistenceManagerImpl,ResultSet,int,ClassResolver)
can correctly determine a class.
getValue in class SubclassProviderImplprotected int getIndicatorColumnSQLType()
SubclassProviderImplSQLTypes type constant for the indicator
column used by this mapping/provider combination.getIndicatorColumnSQLType in class SubclassProviderImpl
protected void registerSubclassMapping(Class cls,
Object val)
cls to
val. This ensures that no two classes in the same
inheritance hierarchy have the same mapping value.protected String getClassName(Object val)
val, or null if no mapping exists
for val.
|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||