org.datanucleus.store.mapped.mapping
Class TypeConverterMapping

java.lang.Object
  extended by org.datanucleus.store.mapped.mapping.JavaTypeMapping
      extended by org.datanucleus.store.mapped.mapping.SingleFieldMapping
          extended by org.datanucleus.store.mapped.mapping.TypeConverterMapping

public class TypeConverterMapping
extends SingleFieldMapping

Mapping where the member has its value converted to/from some storable datastore type using a TypeConverter.


Field Summary
 
Fields inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping
absFieldNumber, datastoreContainer, datastoreMappings, LOCALISER, mmd, referenceMapping, roleForMember, storeMgr, type
 
Constructor Summary
TypeConverterMapping()
           
 
Method Summary
 boolean getBoolean(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 byte getByte(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 char getChar(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 double getDouble(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 float getFloat(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 int getInt(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 Class getJavaType()
          Accessor for the java type being mapped.
 String getJavaTypeForDatastoreMapping(int index)
          Accessor for the name of the java-type actually used when mapping the particular datastore field.
 long getLong(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 Object getObject(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 short getShort(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 String getString(ExecutionContext ec, Object resultSet, int[] exprIndex)
          Obtains a value from datastoreResults at position specified by exprIndex.
 void initialize(AbstractMemberMetaData fmd, DatastoreContainerObject container, ClassLoaderResolver clr)
          Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.
 void setBoolean(ExecutionContext ec, Object preparedStatement, int[] exprIndex, boolean value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setByte(ExecutionContext ec, Object preparedStatement, int[] exprIndex, byte value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setChar(ExecutionContext ec, Object preparedStatement, int[] exprIndex, char value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setDouble(ExecutionContext ec, Object preparedStatement, int[] exprIndex, double value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setFloat(ExecutionContext ec, Object preparedStatement, int[] exprIndex, float value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setInt(ExecutionContext ec, Object preparedStatement, int[] exprIndex, int value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setLong(ExecutionContext ec, Object preparedStatement, int[] exprIndex, long value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setObject(ExecutionContext ec, Object preparedStatement, int[] exprIndex, Object value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setShort(ExecutionContext ec, Object preparedStatement, int[] exprIndex, short value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 void setString(ExecutionContext ec, Object preparedStatement, int[] exprIndex, String value)
          Sets a value into datastoreStatement at position specified by exprIndex.
 
Methods inherited from class org.datanucleus.store.mapped.mapping.SingleFieldMapping
equals, getDefaultLength, getValidValues, prepareDatastoreMapping
 
Methods inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping
addDatastoreMapping, failureMessage, getAbsoluteFieldNumber, getColumnMetaDataForMember, getDatastoreContainer, getDatastoreMapping, getDatastoreMappings, getMemberMetaData, getNumberOfDatastoreMappings, getObject, getReferenceMapping, getRoleForMember, getStoreManager, getType, getValueForDatastoreMapping, hashCode, hasSimpleDatastoreRepresentation, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, initialize, isNullable, isSerialised, representableAsStringLiteralInStatement, setAbsFieldNumber, setDatastoreContainer, setMemberMetaData, setObject, setReferenceMapping, setRoleForMember
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeConverterMapping

public TypeConverterMapping()
Method Detail

initialize

public void initialize(AbstractMemberMetaData fmd,
                       DatastoreContainerObject container,
                       ClassLoaderResolver clr)
Description copied from class: SingleFieldMapping
Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.

Overrides:
initialize in class SingleFieldMapping
Parameters:
fmd - FieldMetaData for the field to be mapped (if any)
container - The datastore container storing this mapping (if any)
clr - the ClassLoaderResolver

getJavaTypeForDatastoreMapping

public String getJavaTypeForDatastoreMapping(int index)
Accessor for the name of the java-type actually used when mapping the particular datastore field. This java-type must have an entry in the datastore mappings.

Overrides:
getJavaTypeForDatastoreMapping in class SingleFieldMapping
Parameters:
index - requested datastore field index.
Returns:
the name of java-type for the requested datastore field.

getJavaType

public Class getJavaType()
Description copied from class: JavaTypeMapping
Accessor for the java type being mapped. This is the java type that the mapping represents. Some examples : The "java type" is the java-type name used in the plugin.xml mapping file

Specified by:
getJavaType in class JavaTypeMapping
Returns:
The java type

setBoolean

public void setBoolean(ExecutionContext ec,
                       Object preparedStatement,
                       int[] exprIndex,
                       boolean value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setBoolean in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getBoolean

public boolean getBoolean(ExecutionContext ec,
                          Object resultSet,
                          int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getBoolean in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setByte

public void setByte(ExecutionContext ec,
                    Object preparedStatement,
                    int[] exprIndex,
                    byte value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setByte in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getByte

public byte getByte(ExecutionContext ec,
                    Object resultSet,
                    int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getByte in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setChar

public void setChar(ExecutionContext ec,
                    Object preparedStatement,
                    int[] exprIndex,
                    char value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setChar in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getChar

public char getChar(ExecutionContext ec,
                    Object resultSet,
                    int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getChar in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setDouble

public void setDouble(ExecutionContext ec,
                      Object preparedStatement,
                      int[] exprIndex,
                      double value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setDouble in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getDouble

public double getDouble(ExecutionContext ec,
                        Object resultSet,
                        int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getDouble in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setFloat

public void setFloat(ExecutionContext ec,
                     Object preparedStatement,
                     int[] exprIndex,
                     float value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setFloat in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getFloat

public float getFloat(ExecutionContext ec,
                      Object resultSet,
                      int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getFloat in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setInt

public void setInt(ExecutionContext ec,
                   Object preparedStatement,
                   int[] exprIndex,
                   int value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setInt in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getInt

public int getInt(ExecutionContext ec,
                  Object resultSet,
                  int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getInt in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setLong

public void setLong(ExecutionContext ec,
                    Object preparedStatement,
                    int[] exprIndex,
                    long value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setLong in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getLong

public long getLong(ExecutionContext ec,
                    Object resultSet,
                    int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getLong in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setShort

public void setShort(ExecutionContext ec,
                     Object preparedStatement,
                     int[] exprIndex,
                     short value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setShort in class SingleFieldMapping
Parameters:
ec - execution context
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getShort

public short getShort(ExecutionContext ec,
                      Object resultSet,
                      int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getShort in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setString

public void setString(ExecutionContext ec,
                      Object preparedStatement,
                      int[] exprIndex,
                      String value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setString in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getString

public String getString(ExecutionContext ec,
                        Object resultSet,
                        int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getString in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value

setObject

public void setObject(ExecutionContext ec,
                      Object preparedStatement,
                      int[] exprIndex,
                      Object value)
Description copied from class: JavaTypeMapping
Sets a value into datastoreStatement at position specified by exprIndex.

Overrides:
setObject in class SingleFieldMapping
Parameters:
ec - ExecutionContext
preparedStatement - a datastore object that executes statements in the database
exprIndex - the position of the value in the statement
value - the value

getObject

public Object getObject(ExecutionContext ec,
                        Object resultSet,
                        int[] exprIndex)
Description copied from class: JavaTypeMapping
Obtains a value from datastoreResults at position specified by exprIndex.

Overrides:
getObject in class SingleFieldMapping
Parameters:
ec - ExecutionContext
resultSet - an object returned from the datastore with values
exprIndex - the position of the value in the result
Returns:
the value


Copyright © 2012. All Rights Reserved.