|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.mapped.mapping.JavaTypeMapping
org.datanucleus.store.mapped.mapping.SingleFieldMapping
org.datanucleus.store.mapped.mapping.EnumMapping
public class EnumMapping
Mapping for JDK1.5 Enum type.
| Field Summary | |
|---|---|
protected java.lang.String |
datastoreJavaType
|
protected static java.lang.String |
ENUM_GETTER_BY_VALUE
|
protected static java.lang.String |
ENUM_VALUE_GETTER
|
| Fields inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping |
|---|
datastoreContainer, datastoreMappings, LOCALISER, mmd, referenceMapping, roleForMember, storeMgr, type |
| Constructor Summary | |
|---|---|
EnumMapping()
|
|
| Method Summary | |
|---|---|
protected java.lang.Object |
getEnumValueForMethod(java.lang.Class enumType,
long val,
java.lang.String methodName)
Convenience method to return the value of an Enum using a static getter method, passing in a value. |
java.lang.Class |
getJavaType()
Accessor for the java type being mapped. |
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(ExecutionContext ec,
java.lang.Object resultSet,
int[] exprIndex)
Method to extract the Enum object from the passed result set. |
java.lang.Object[] |
getValidValues(int index)
Accessor for the valid values for this mapping (if any restriction is imposed). |
protected java.lang.Long |
getValueForEnumUsingMethod(java.lang.Enum value,
java.lang.String methodName)
Convenience method to get the value to be persisted for an Enum via a method call. |
void |
initialize(AbstractMemberMetaData fmd,
DatastoreContainerObject container,
ClassLoaderResolver clr)
Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData. |
void |
setObject(ExecutionContext ec,
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 java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String ENUM_VALUE_GETTER
protected static final java.lang.String ENUM_GETTER_BY_VALUE
protected java.lang.String datastoreJavaType
| Constructor Detail |
|---|
public EnumMapping()
| Method Detail |
|---|
public void initialize(AbstractMemberMetaData fmd,
DatastoreContainerObject container,
ClassLoaderResolver clr)
initialize in class SingleFieldMappingcontainer - The datastore container storing this mapping (if any)clr - the ClassLoaderResolverfmd - FieldMetaData for the field to be mapped (if any)public java.lang.Object[] getValidValues(int index)
getValidValues in class SingleFieldMappingindex - The index of the datastore column
public java.lang.String getJavaTypeForDatastoreMapping(int index)
getJavaTypeForDatastoreMapping in class SingleFieldMappingindex - requested datastore field index.
public java.lang.Class getJavaType()
JavaTypeMapping
getJavaType in class JavaTypeMapping
public void setObject(ExecutionContext ec,
java.lang.Object preparedStatement,
int[] exprIndex,
java.lang.Object value)
setObject in class SingleFieldMappingec - ExecutionContextpreparedStatement - Statement for the datastoreexprIndex - Index position(s) to set the Enum at in the statementvalue - The Enum value to set
protected java.lang.Long getValueForEnumUsingMethod(java.lang.Enum value,
java.lang.String methodName)
value - The Enum valuemethodName - The name of the method
public java.lang.Object getObject(ExecutionContext ec,
java.lang.Object resultSet,
int[] exprIndex)
getObject in class SingleFieldMappingec - ExecutionContextresultSet - The result setexprIndex - The index position(s) in the result set to use.
protected java.lang.Object getEnumValueForMethod(java.lang.Class enumType,
long val,
java.lang.String methodName)
enumType - The type of the enumval - The value to pass inmethodName - Name of the static method
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||