Class SingleFieldMapping
- java.lang.Object
-
- org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
-
- org.datanucleus.store.rdbms.mapping.java.SingleFieldMapping
-
- Direct Known Subclasses:
AbstractContainerMapping,BigDecimalMapping,BigIntegerMapping,BitSetMapping,BooleanMapping,ByteMapping,CharacterMapping,DatastoreIdMapping,DiscriminatorMapping,DoubleMapping,EmbeddedMapping,EnumMapping,FileMapping,FloatMapping,IntegerMapping,LongMapping,NullMapping,NumberMapping,OrderIndexMapping,SerialisedMapping,ShortMapping,SQLFunctionMapping,StringMapping,TemporalMapping,TypeConverterMapping,UUIDMapping,VersionMapping
public abstract class SingleFieldMapping extends JavaTypeMapping
Simple mapping for a java field mapping to a single column.
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXTENSION_CHECK_CONSTRAINT_VALUESMetadata extension key that the column needs a CHECK constraint in the datastore on specific 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 SingleFieldMapping()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.bytegetByte(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.chargetChar(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.intgetDefaultLength(int index)Accessor for the default length for this type in the datastore (if applicable).doublegetDouble(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.floatgetFloat(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.intgetInt(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.StringgetJavaTypeForColumnMapping(int index)Accessor for the name of the java-type actually used when mapping the particular datastore field.longgetLong(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.ObjectgetObject(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.shortgetShort(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.StringgetString(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.Object[]getValidValues(int index)Accessor for an array of valid values that this type can take.voidinitialize(org.datanucleus.metadata.AbstractMemberMetaData fmd, Table table, org.datanucleus.ClassLoaderResolver clr)Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.protected voidprepareColumnMapping()Method to prepare a column mapping for use in the datastore.voidsetBoolean(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, boolean value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetByte(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, byte value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetChar(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, char value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetDouble(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, double value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetFloat(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, float value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetInt(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, int value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetLong(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, long value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetShort(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, short value)Sets avalueintodatastoreStatementat position specified byexprIndex.voidsetString(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, String value)Sets avalueintodatastoreStatementat position specified byexprIndex.-
Methods inherited from class org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
addColumnMapping, equals, failureMessage, getAbsoluteFieldNumber, getColumnMapping, getColumnMappings, getColumnMetaDataForMember, getJavaType, 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_VALUES
public static final String EXTENSION_CHECK_CONSTRAINT_VALUES
Metadata extension key that the column needs a CHECK constraint in the datastore on specific values. Set it to the valid values.- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(org.datanucleus.metadata.AbstractMemberMetaData fmd, Table table, org.datanucleus.ClassLoaderResolver clr)Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.- Overrides:
initializein classJavaTypeMapping- Parameters:
table- The datastore container storing this mapping (if any)clr- the ClassLoaderResolverfmd- FieldMetaData for the field to be mapped (if any)
-
prepareColumnMapping
protected void prepareColumnMapping()
Method to prepare a column mapping for use in the datastore. This creates the column in the table.
-
getDefaultLength
public int getDefaultLength(int index)
Accessor for the default length for this type in the datastore (if applicable).- Parameters:
index- requested column index.- Returns:
- Default length
-
getValidValues
public Object[] getValidValues(int index)
Accessor for an array of valid values that this type can take. This can be used at the datastore side for restricting the values to be inserted.- Parameters:
index- requested column index.- Returns:
- The valid values
-
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 classJavaTypeMapping- Parameters:
index- requested column index.- Returns:
- the name of java-type for the requested column.
-
setBoolean
public void setBoolean(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, boolean value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setBooleanin classJavaTypeMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getBoolean
public boolean getBoolean(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getBooleanin classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
setChar
public void setChar(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, char value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setCharin classJavaTypeMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getChar
public char getChar(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getCharin classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
setByte
public void setByte(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, byte value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setBytein classJavaTypeMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getByte
public byte getByte(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getBytein classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
setShort
public void setShort(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, short value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setShortin classJavaTypeMapping- Parameters:
ec- execution contextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getShort
public short getShort(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getShortin classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
setInt
public void setInt(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, int value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setIntin classJavaTypeMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getInt
public int getInt(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getIntin classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
setLong
public void setLong(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, long value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setLongin classJavaTypeMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getLong
public long getLong(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getLongin classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
setFloat
public void setFloat(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, float value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setFloatin classJavaTypeMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getFloat
public float getFloat(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getFloatin classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
setDouble
public void setDouble(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, double value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setDoublein classJavaTypeMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getDouble
public double getDouble(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getDoublein classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
setString
public void setString(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, String value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setStringin classJavaTypeMapping- Parameters:
ec- ExecutionContextps- PreparedStatementexprIndex- the position of the value in the statementvalue- the value
-
getString
public String getString(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)
Description copied from class:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getStringin classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
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 classJavaTypeMapping- 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 classJavaTypeMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
-