org.datanucleus.store.mapped.mapping
Class EnumMapping

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.EnumMapping
All Implemented Interfaces:
org.datanucleus.store.mapped.mapping.SimpleDatastoreRepresentation

public class EnumMapping
extends org.datanucleus.store.mapped.mapping.SingleFieldMapping
implements org.datanucleus.store.mapped.mapping.SimpleDatastoreRepresentation

Mapping for JDK1.5 Enum type.


Field Summary
protected  java.lang.String datastoreJavaType
           
 
Fields inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping
datastoreContainer, datastoreMappings, dba, fmd, LOCALISER, MAPPING_ARRAY_ELEMENT, MAPPING_COLLECTION_ELEMENT, MAPPING_FIELD, MAPPING_MAP_KEY, MAPPING_MAP_VALUE, referenceMapping, roleForField, type
 
Constructor Summary
EnumMapping()
           
 
Method Summary
 java.lang.Class getJavaType()
           
 java.lang.String getJavaTypeForDatastoreMapping(int index)
          Accessor for the name of the java-type actually used when mapping the particular datastore field.
 java.lang.Object getObject(org.datanucleus.ObjectManager om, java.lang.Object resultSet, int[] exprIndex)
          Method to extract the Enum object from the passed result set.
 java.lang.Object getSampleValue(org.datanucleus.ClassLoaderResolver clr)
           
 org.datanucleus.store.mapped.expression.ScalarExpression[] getValidValues(int index)
          Accessor for the valid values for this mapping (if any restriction is imposed).
 void initialize(org.datanucleus.store.mapped.DatastoreAdapter dba, org.datanucleus.metadata.AbstractMemberMetaData fmd, org.datanucleus.store.mapped.DatastoreContainerObject container, org.datanucleus.ClassLoaderResolver clr)
          Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.
 org.datanucleus.store.mapped.expression.ScalarExpression newLiteral(org.datanucleus.store.mapped.expression.QueryExpression qs, java.lang.Object value)
           
 org.datanucleus.store.mapped.expression.ScalarExpression newScalarExpression(org.datanucleus.store.mapped.expression.QueryExpression qs, org.datanucleus.store.mapped.expression.LogicSetExpression te)
           
 void setObject(org.datanucleus.ObjectManager om, java.lang.Object preparedStatement, int[] exprIndex, java.lang.Object value)
          Method to set the Enum in the datastore statement.
 
Methods inherited from class org.datanucleus.store.mapped.mapping.SingleFieldMapping
equals, getBoolean, getByte, getChar, getDefaultLength, getDouble, getFloat, getInt, getLong, getShort, getString, prepareDatastoreMapping, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString
 
Methods inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping
addDataStoreMapping, failureMessage, getDatastoreContainer, getDataStoreMapping, getDataStoreMappings, getFieldMetaData, getNumberOfDatastoreFields, getObject, getReferenceMapping, getRoleForField, getType, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, initialize, isNullable, isSerialised, setDefault, setFieldInformation, setObject, setReferenceMapping, setRoleForField
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datastoreJavaType

protected java.lang.String datastoreJavaType
Constructor Detail

EnumMapping

public EnumMapping()
Method Detail

initialize

public void initialize(org.datanucleus.store.mapped.DatastoreAdapter dba,
                       org.datanucleus.metadata.AbstractMemberMetaData fmd,
                       org.datanucleus.store.mapped.DatastoreContainerObject container,
                       org.datanucleus.ClassLoaderResolver clr)
Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.

Overrides:
initialize in class org.datanucleus.store.mapped.mapping.SingleFieldMapping
Parameters:
dba - The Datastore Adapter that this Mapping should use.
fmd - FieldMetaData for the field to be mapped (if any)
container - The datastore container storing this mapping (if any)
clr - the ClassLoaderResolver

getValidValues

public org.datanucleus.store.mapped.expression.ScalarExpression[] getValidValues(int index)
Accessor for the valid values for this mapping (if any restriction is imposed).

Overrides:
getValidValues in class org.datanucleus.store.mapped.mapping.SingleFieldMapping
Parameters:
index - The index of the datastore column
Returns:
The valid value(s)

getJavaTypeForDatastoreMapping

public java.lang.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 org.datanucleus.store.mapped.mapping.SingleFieldMapping
Parameters:
index - requested datastore field index.
Returns:
the name of java-type for the requested datastore field.

getJavaType

public java.lang.Class getJavaType()
Specified by:
getJavaType in class org.datanucleus.store.mapped.mapping.JavaTypeMapping

setObject

public void setObject(org.datanucleus.ObjectManager om,
                      java.lang.Object preparedStatement,
                      int[] exprIndex,
                      java.lang.Object value)
Method to set the Enum in the datastore statement.

Overrides:
setObject in class org.datanucleus.store.mapped.mapping.SingleFieldMapping
Parameters:
om - ObjectManager
preparedStatement - Statement for the datastore
exprIndex - Index position(s) to set the Enum at in the statement
value - The Enum value to set

getObject

public java.lang.Object getObject(org.datanucleus.ObjectManager om,
                                  java.lang.Object resultSet,
                                  int[] exprIndex)
Method to extract the Enum object from the passed result set.

Overrides:
getObject in class org.datanucleus.store.mapped.mapping.SingleFieldMapping
Parameters:
om - ObjectManager
resultSet - The result set
exprIndex - The index position(s) in the result set to use.
Returns:
The Enum

getSampleValue

public java.lang.Object getSampleValue(org.datanucleus.ClassLoaderResolver clr)
Specified by:
getSampleValue in class org.datanucleus.store.mapped.mapping.JavaTypeMapping

newLiteral

public org.datanucleus.store.mapped.expression.ScalarExpression newLiteral(org.datanucleus.store.mapped.expression.QueryExpression qs,
                                                                           java.lang.Object value)
Specified by:
newLiteral in class org.datanucleus.store.mapped.mapping.JavaTypeMapping

newScalarExpression

public org.datanucleus.store.mapped.expression.ScalarExpression newScalarExpression(org.datanucleus.store.mapped.expression.QueryExpression qs,
                                                                                    org.datanucleus.store.mapped.expression.LogicSetExpression te)
Specified by:
newScalarExpression in class org.datanucleus.store.mapped.mapping.JavaTypeMapping


Copyright © 2009. All Rights Reserved.