|
||||||||||
| 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 String |
datastoreJavaType
|
protected static String |
ENUM_GETTER_BY_VALUE
|
protected static String |
ENUM_VALUE_GETTER
|
| Fields inherited from class org.datanucleus.store.mapped.mapping.JavaTypeMapping |
|---|
absFieldNumber, datastoreContainer, datastoreMappings, LOCALISER, mmd, referenceMapping, roleForMember, storeMgr, type |
| Constructor Summary | |
|---|---|
EnumMapping()
|
|
| Method Summary | |
|---|---|
protected Object |
getEnumValueForMethod(Class enumType,
long val,
String methodName)
Convenience method to return the value of an Enum using a static getter method, passing in a value. |
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. |
Object |
getObject(ExecutionContext ec,
Object resultSet,
int[] exprIndex)
Method to extract the Enum object from the passed result set. |
Object[] |
getValidValues(int index)
Accessor for the valid values for this mapping (if any restriction is imposed). |
protected Long |
getValueForEnumUsingMethod(Enum value,
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,
Object preparedStatement,
int[] exprIndex,
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 String ENUM_VALUE_GETTER
protected static final String ENUM_GETTER_BY_VALUE
protected String datastoreJavaType
| Constructor Detail |
|---|
public EnumMapping()
| Method Detail |
|---|
public void initialize(AbstractMemberMetaData fmd,
DatastoreContainerObject container,
ClassLoaderResolver clr)
initialize in class SingleFieldMappingfmd - FieldMetaData for the field to be mapped (if any)container - The datastore container storing this mapping (if any)clr - the ClassLoaderResolverpublic Object[] getValidValues(int index)
getValidValues in class SingleFieldMappingindex - The index of the datastore column
public String getJavaTypeForDatastoreMapping(int index)
getJavaTypeForDatastoreMapping in class SingleFieldMappingindex - requested datastore field index.
public Class getJavaType()
JavaTypeMapping
getJavaType in class JavaTypeMapping
public void setObject(ExecutionContext ec,
Object preparedStatement,
int[] exprIndex,
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 Long getValueForEnumUsingMethod(Enum value,
String methodName)
value - The Enum valuemethodName - The name of the method
public Object getObject(ExecutionContext ec,
Object resultSet,
int[] exprIndex)
getObject in class SingleFieldMappingec - ExecutionContextresultSet - The result setexprIndex - The index position(s) in the result set to use.
protected Object getEnumValueForMethod(Class enumType,
long val,
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 | |||||||||