com.solarmetric.kodo.impl.jdbc.ormapping
Class StringificationMapping
java.lang.Object
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.Mapping
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.FieldMapping
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.ValueMapping
|
+--com.solarmetric.kodo.impl.jdbc.ormapping.StringificationMapping
- All Implemented Interfaces:
- LoadPrimary, PrimaryTable, StorePrimary
- public class StringificationMapping
- extends ValueMapping
- implements LoadPrimary
Mapping that allows storage of a second class object via
customization stringification fields, utilizing the
externalizer and factory metadata
extensions.
|
Method Summary |
protected boolean |
canMap(FieldMetaData fmd,
ClassResolver resolver)
If we have the externalizer metadata extension, then
we can use this mapping. |
Object |
getDataStoreValue(Object val,
PersistenceManagerImpl pm)
Translate the given field value to its datastore equivalent. |
protected String |
getExternalizedValue(Object ob,
ClassResolver resolver)
Return the string value produced by the externalizer fro the
given field. |
protected void |
install(FieldMetaData fmd,
JDBCConfiguration conf,
ClassResolver resolver,
DBDictionary dict)
Install the mapping. |
protected Object |
instantiateObject(String fromString,
Member factory,
StateManagerImpl sm)
Instantiate the specified Object based on the
factory method. |
void |
load(StateManagerImpl sm,
int field,
ResultSet rs,
int index)
Load the field from the specified ResultSet by invoking
the factory Member. |
void |
update(Update update,
StateManagerImpl sm,
int field)
Set the field of the Update by invoking the
externalizer Method. |
| Methods inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.ValueMapping |
appendIsEmpty, appendIsNotNull, appendIsNull, delete, getColumns, getKeyColumns, insert, join, joinKey, joinKeyRelation, joinRelation, select, select |
| Methods inherited from class com.solarmetric.kodo.impl.jdbc.ormapping.Mapping |
checkExtension, createMapping, createMapping, createMappings, createMappings, getClassName, getConfiguration, getDictionary, getFieldMapping, getInstance, getTable, install |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.solarmetric.kodo.impl.jdbc.ormapping.LoadPrimary |
select |
EXTERNALIZER
public static final String EXTERNALIZER
FACTORY
public static final String FACTORY
StringificationMapping
public StringificationMapping()
canMap
protected boolean canMap(FieldMetaData fmd,
ClassResolver resolver)
- If we have the
externalizer metadata extension, then
we can use this mapping.
- Overrides:
canMap in class ValueMapping
instantiateObject
protected Object instantiateObject(String fromString,
Member factory,
StateManagerImpl sm)
- Instantiate the specified
Object based on the
factory method.
- Parameters:
fromString - the parameter to use to instantiate the Object- Returns:
- the instantiated Object
install
protected void install(FieldMetaData fmd,
JDBCConfiguration conf,
ClassResolver resolver,
DBDictionary dict)
- Install the mapping. This validates that the
factory and
externalizer field metadata specifications are valid.
However, this class does not maintain the reflection fields, since
we need to be ClassLoader-agnostic. That is, if we lock down
a factory Member and an externalizer Method, then
this FieldMetaData could only be used to instantiate classes
that were loaded in the same ClassLoader that was used to
initialize the mapping, which causes problems with using multiple
class loaders.
- Overrides:
install in class ValueMapping
load
public void load(StateManagerImpl sm,
int field,
ResultSet rs,
int index)
throws SQLException
- Load the field from the specified
ResultSet by invoking
the factory Member.
- Specified by:
load in interface LoadPrimary- Overrides:
load in class ValueMapping
update
public void update(Update update,
StateManagerImpl sm,
int field)
throws SQLException
- Set the field of the
Update by invoking the
externalizer Method.
- Overrides:
update in class ValueMapping
getExternalizedValue
protected String getExternalizedValue(Object ob,
ClassResolver resolver)
- Return the string value produced by the externalizer fro the
given field.
getDataStoreValue
public Object getDataStoreValue(Object val,
PersistenceManagerImpl pm)
- Translate the given field value to its datastore equivalent.
- Overrides:
getDataStoreValue in class FieldMapping
Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.