org.datanucleus.store.mapped.mapping
Class VersionMapping

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.VersionMapping
Direct Known Subclasses:
VersionLongMapping, VersionTimestampMapping

public class VersionMapping
extends SingleFieldMapping

Mapping class for mapping version state/timestamp columns in the database. This class is for internal use only. It should not be used in user mappings.


Field Summary
 
Fields inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping
datastoreContainer, datastoreMappings, LOCALISER, mmd, referenceMapping, roleForMember, storeMgr, type
 
Constructor Summary
VersionMapping(DatastoreAdapter dba, DatastoreContainerObject datastoreContainer, JavaTypeMapping delegate)
          Constructor.
 
Method Summary
 void addDatastoreMapping(DatastoreMapping datastoreMapping)
          Method to add a datastore mapping.
 DatastoreMapping getDatastoreMapping(int index)
          Accessor for a datastore mapping.
 DatastoreMapping[] getDatastoreMappings()
          Accessor for the datastore mappings for this java type.
 java.lang.Class getJavaType()
          Accessor for the type represented here, returning the class itself
 int getNumberOfDatastoreMappings()
          Accessor for the number of datastore fields.
 java.lang.Object getObject(ObjectManager om, java.lang.Object resultSet, int[] exprIndex)
          Accessor for the object in this column
 java.lang.Object getSampleValue(ClassLoaderResolver clr)
          Accessor for a sample value for this column
 boolean includeInFetchStatement()
          Accessor for whether to include this column in any fetch statement
 ScalarExpression newLiteral(QueryExpression qs, java.lang.Object value)
          Accessor for a new literal for this mapping.
 ScalarExpression newScalarExpression(QueryExpression qs, LogicSetExpression te)
          Accessor for a new literal for this mapping.
 void setObject(ObjectManager om, java.lang.Object preparedStatement, int[] exprIndex, java.lang.Object value)
          Mutator for the object in this column
 
Methods inherited from class org.datanucleus.store.mapped.mapping.SingleFieldMapping
equals, getBoolean, getByte, getChar, getDefaultLength, getDouble, getFloat, getInt, getJavaTypeForDatastoreMapping, getLong, getShort, getString, getValidValues, initialize, prepareDatastoreMapping, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString
 
Methods inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping
failureMessage, getColumnMetaDataForMember, getDatastoreContainer, getMemberMetaData, getObject, getReferenceMapping, getRoleForMember, getType, getValueForDatastoreMapping, hashCode, hasSimpleDatastoreRepresentation, includeInInsertStatement, includeInUpdateStatement, initialize, isNullable, isSerialised, setDatastoreContainer, setDefault, setMemberMetaData, setObject, setReferenceMapping, setRoleForMember
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionMapping

public VersionMapping(DatastoreAdapter dba,
                      DatastoreContainerObject datastoreContainer,
                      JavaTypeMapping delegate)
Constructor.

Parameters:
dba - Datastore Adapter
datastoreContainer - Datastore table
delegate - The JavaTypeMapping to delegate the storage
Method Detail

getSampleValue

public java.lang.Object getSampleValue(ClassLoaderResolver clr)
Accessor for a sample value for this column

Overrides:
getSampleValue in class JavaTypeMapping
Parameters:
clr - ClassLoader resolver
Returns:
The sample value

newLiteral

public ScalarExpression newLiteral(QueryExpression qs,
                                   java.lang.Object value)
Accessor for a new literal for this mapping.

Overrides:
newLiteral in class JavaTypeMapping
Parameters:
qs - The QueryStatement
value - The value of the object
Returns:
The new literal

newScalarExpression

public ScalarExpression newScalarExpression(QueryExpression qs,
                                            LogicSetExpression te)
Accessor for a new literal for this mapping.

Overrides:
newScalarExpression in class JavaTypeMapping
Parameters:
qs - The QueryStatement
te - The table expression
Returns:
The new literal

includeInFetchStatement

public boolean includeInFetchStatement()
Accessor for whether to include this column in any fetch statement

Overrides:
includeInFetchStatement in class JavaTypeMapping
Returns:
Whether to include the column when fetching.

getNumberOfDatastoreMappings

public int getNumberOfDatastoreMappings()
Accessor for the number of datastore fields.

Overrides:
getNumberOfDatastoreMappings in class JavaTypeMapping
Returns:
Number of datastore fields.

getDatastoreMapping

public DatastoreMapping getDatastoreMapping(int index)
Accessor for a datastore mapping.

Overrides:
getDatastoreMapping in class JavaTypeMapping
Parameters:
index - The mapping index
Returns:
the datastore mapping

getDatastoreMappings

public DatastoreMapping[] getDatastoreMappings()
Accessor for the datastore mappings for this java type.

Overrides:
getDatastoreMappings in class JavaTypeMapping
Returns:
The datastore mapping(s)

addDatastoreMapping

public void addDatastoreMapping(DatastoreMapping datastoreMapping)
Method to add a datastore mapping.

Overrides:
addDatastoreMapping in class JavaTypeMapping
Parameters:
datastoreMapping - The mapping

getJavaType

public java.lang.Class getJavaType()
Accessor for the type represented here, returning the class itself

Specified by:
getJavaType in class JavaTypeMapping
Returns:
This class.

setObject

public void setObject(ObjectManager om,
                      java.lang.Object preparedStatement,
                      int[] exprIndex,
                      java.lang.Object value)
Mutator for the object in this column

Overrides:
setObject in class SingleFieldMapping
Parameters:
om - The ObjectManager
preparedStatement - The statement
exprIndex - The indexes
value - The value to set it to

getObject

public java.lang.Object getObject(ObjectManager om,
                                  java.lang.Object resultSet,
                                  int[] exprIndex)
Accessor for the object in this column

Overrides:
getObject in class SingleFieldMapping
Parameters:
om - The ObjectManager
resultSet - The ResultSet to get the value from
exprIndex - The indexes
Returns:
The object


Copyright © 2010. All Rights Reserved.