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
Simple mapping for a java field mapping to a single column.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMetadata extension key that the column needs a CHECK constraint in the datastore on specific values.Fields inherited from class JavaTypeMapping
absFieldNumber, columnMappings, mmd, referenceMapping, roleForMember, storeMgr, table, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolean(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex) Obtains a value fromdatastoreResultsat position specified byexprIndex.byteObtains a value fromdatastoreResultsat position specified byexprIndex.charObtains a value fromdatastoreResultsat position specified byexprIndex.intgetDefaultLength(int index) Accessor for the default length for this type in the datastore (if applicable).doubleObtains a value fromdatastoreResultsat position specified byexprIndex.floatObtains a value fromdatastoreResultsat position specified byexprIndex.intObtains a value fromdatastoreResultsat position specified byexprIndex.getJavaTypeForColumnMapping(int index) Accessor for the name of the java-type actually used when mapping the particular datastore field.longObtains a value fromdatastoreResultsat position specified byexprIndex.Obtains a value fromdatastoreResultsat position specified byexprIndex.shortObtains a value fromdatastoreResultsat position specified byexprIndex.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 voidMethod 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 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 Details
-
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:
-
-
Constructor Details
-
SingleFieldMapping
public SingleFieldMapping()
-
-
Method Details
-
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:
fmd- FieldMetaData for the field to be mapped (if any)table- The datastore container storing this mapping (if any)clr- the ClassLoaderResolver
-
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
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
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
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
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
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
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
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
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
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
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
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
-