Class EnumMapping
- java.lang.Object
-
- org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
-
- org.datanucleus.store.rdbms.mapping.java.SingleFieldMapping
-
- org.datanucleus.store.rdbms.mapping.java.EnumMapping
-
public class EnumMapping extends SingleFieldMapping
Mapping for Enum type.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringdatastoreJavaTypestatic StringEXTENSION_CHECK_CONSTRAINT_ENUM_VALUESMetadata extension key for specifying that the enum column has a CHECK constraint in the datastore.-
Fields inherited from class org.datanucleus.store.rdbms.mapping.java.SingleFieldMapping
EXTENSION_CHECK_CONSTRAINT_VALUES
-
Fields inherited from class org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
absFieldNumber, columnMappings, mmd, referenceMapping, roleForMember, storeMgr, table, type
-
-
Constructor Summary
Constructors Constructor Description EnumMapping()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassgetJavaType()Accessor for the java type being mapped.StringgetJavaTypeForColumnMapping(int index)Accessor for the name of the java-type actually used when mapping the particular datastore field.ObjectgetObject(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.Object[]getValidValues(int index)Accessor for the valid values for this mapping (if any restriction is imposed).voidinitialize(org.datanucleus.metadata.AbstractMemberMetaData mmd, Table table, org.datanucleus.ClassLoaderResolver clr)Initialize this JavaTypeMapping for the given member MetaData and Table owning it.voidsetObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)Sets avalueintodatastoreStatementat position specified byexprIndex.-
Methods inherited from class org.datanucleus.store.rdbms.mapping.java.SingleFieldMapping
getBoolean, getByte, getChar, getDefaultLength, getDouble, getFloat, getInt, getLong, getShort, getString, prepareColumnMapping, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString
-
Methods inherited from class org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
addColumnMapping, equals, failureMessage, getAbsoluteFieldNumber, getColumnMapping, getColumnMappings, getColumnMetaDataForMember, getMemberMetaData, getNumberOfColumnMappings, getObject, getReferenceMapping, getRoleForMember, getStoreManager, getTable, getType, getValueForColumnMapping, hashCode, hasSimpleDatastoreRepresentation, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, initialize, isNullable, isSerialised, performSetPostProcessing, representableAsStringLiteralInStatement, requiresSetPostProcessing, setAbsFieldNumber, setMemberMetaData, setObject, setReferenceMapping, setRoleForMember, setTable
-
-
-
-
Field Detail
-
EXTENSION_CHECK_CONSTRAINT_ENUM_VALUES
public static final String EXTENSION_CHECK_CONSTRAINT_ENUM_VALUES
Metadata extension key for specifying that the enum column has a CHECK constraint in the datastore. Set it to "true" to enable.- See Also:
- Constant Field Values
-
datastoreJavaType
protected String datastoreJavaType
-
-
Method Detail
-
initialize
public void initialize(org.datanucleus.metadata.AbstractMemberMetaData mmd, Table table, org.datanucleus.ClassLoaderResolver clr)Initialize this JavaTypeMapping for the given member MetaData and Table owning it.- Overrides:
initializein classSingleFieldMapping- Parameters:
mmd- MetaData for the member to be mapped (if any)table- The table storing this mapping (if any)clr- the ClassLoaderResolver
-
getValidValues
public Object[] getValidValues(int index)
Accessor for the valid values for this mapping (if any restriction is imposed).- Overrides:
getValidValuesin classSingleFieldMapping- Parameters:
index- The index of the datastore column- Returns:
- The valid value(s)
-
getJavaTypeForColumnMapping
public String getJavaTypeForColumnMapping(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:
getJavaTypeForColumnMappingin classSingleFieldMapping- Parameters:
index- requested column index.- Returns:
- the name of java-type for the requested column.
-
getJavaType
public Class getJavaType()
Description copied from class:JavaTypeMappingAccessor for the java type being mapped. This is the java type that the mapping represents. Some examples :- if the field is of type "MyClass" then the mapping will be OIDMapping (or subclass) the javaType will be OID, and the type will be MyClass.
- if the field is of type "int" then the mapping will be IntegerMapping, the javaType will be Integer, and the type will be int.
- Specified by:
getJavaTypein classJavaTypeMapping- Returns:
- The java type
-
setObject
public void setObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setObjectin classSingleFieldMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getObject
public Object getObject(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)
Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getObjectin classSingleFieldMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
-