Class ColumnImpl
java.lang.Object
org.datanucleus.store.rdbms.table.ColumnImpl
- All Implemented Interfaces:
Column, org.datanucleus.store.schema.table.Column
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringCHECK constraints to apply to this column in its SQL specification (optional).protected ColumnMappingMapping for this column.protected org.datanucleus.metadata.ColumnMetaDataColumnMetaData for this column.private static final byteprotected ObjectDefault value accepted by the datastore for this column, from DatabaseMetaData.protected byteOperational flags, for nullability, PK, autoinc, etc.protected DatastoreIdentifierIdentifier for the column in the datastore.private static final byteprivate static final byteprivate static final byteprotected final StringJava type that this column is storing.protected final TableTable containing this column in the datastore.protected SQLTypeInfoSQL Type info for the JDBC type being stored in this columnprotected StringManual override of the type name for this column (optional).private static final byteprotected String[]Function wrapping the column (for example, SQRT(COLUMN)).Fields inherited from interface Column
WRAPPER_FUNCTION_INSERT, WRAPPER_FUNCTION_SELECT, WRAPPER_FUNCTION_UPDATE -
Constructor Summary
ConstructorsConstructorDescriptionColumnImpl(Table table, String javaType, DatastoreIdentifier identifier, org.datanucleus.metadata.ColumnMetaData colmd) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionapplySelectFunction(String replacementValue) Wraps the column name with a FUNCTION.final voidChecks the column definition as a decimal.final voidChecks the column definition as an integer.final voidChecks the column definition as a primitive.final voidChecks the column definition as a string.voidcopyConfigurationTo(Column colIn) Copy the configuration of this field to another fieldbooleanAccessor for CHECK constraints for this column.Accessor for the column mapping that this column relates to.final org.datanucleus.metadata.ColumnMetaDataorg.datanucleus.store.schema.naming.ColumnTypeprivate StringConvenience method to return the "DEFAULT" part of the column definition.Accessor for the identifier for this object.Accessor for the JavaTypeMapping for the field/property that owns this column.org.datanucleus.metadata.JdbcTypeorg.datanucleus.store.schema.table.MemberColumnMappingorg.datanucleus.metadata.AbstractMemberMetaDataAccessor for the MetaData of the field/property that this is the column for.getName()intAccessor for the SQL definition of this column.private intAccessor for the precision of data in the column.Accessor for the type of data stored in this field.Accessor for the StoreManager for this column.getTable()Accessor for the table for this columnfinal SQLTypeInfoAccessor for the type info for this column.getWrapperFunction(int wrapperMode) Gets the wrapper for parameters.inthashCode()voidInitialize the default column value and auto incrementfinal booleanbooleanAccessor for the whether this column is an identity column.final booleanfinal booleanfinal booleanisUnique()booleanConvenience method to check if the length is required to be unlimited (BLOB/CLOB).final ColumnsetCheckConstraints(String constraints) Mutator for the CHECK constraints of the column.voidsetColumnMapping(ColumnMapping mapping) Method to associate this column with its mapping.setColumnMetaData(org.datanucleus.metadata.ColumnMetaData colmd) final ColumnsetDefaultable(Object defaultValue) voidsetIdentifier(DatastoreIdentifier identifier) Mutator for the identifier of the column.setIdentity(boolean identity) Mutator for whether we set this column as an identity column.setJdbcType(org.datanucleus.metadata.JdbcType jdbcType) final ColumnsetNullable(boolean flag) setPosition(int pos) final Columnfinal ColumnsetTypeInfo(SQLTypeInfo typeInfo) Mutator for the type information of the column.setTypeName(String type) final ColumnsetUnique(boolean flag) voidsetWrapperFunction(String wrapperFunction, int wrapperMode) Sets a function to wrap the column.toString()voidMethod to validate the contents of the column.
-
Field Details
-
PK
private static final byte PK- See Also:
-
NULLABLE
private static final byte NULLABLE- See Also:
-
UNIQUE
private static final byte UNIQUE- See Also:
-
DEFAULTABLE
private static final byte DEFAULTABLE- See Also:
-
IDENTITY
private static final byte IDENTITY- See Also:
-
identifier
Identifier for the column in the datastore. -
columnMetaData
protected org.datanucleus.metadata.ColumnMetaData columnMetaDataColumnMetaData for this column. -
table
Table containing this column in the datastore. -
columnMapping
Mapping for this column. -
storedJavaType
Java type that this column is storing. (can we just get this from the mapping above ?) -
typeName
Manual override of the type name for this column (optional). -
typeInfo
SQL Type info for the JDBC type being stored in this column -
checkConstraints
CHECK constraints to apply to this column in its SQL specification (optional). -
flags
protected byte flagsOperational flags, for nullability, PK, autoinc, etc. -
defaultValue
Default value accepted by the datastore for this column, from DatabaseMetaData. -
wrapperFunction
Function wrapping the column (for example, SQRT(COLUMN)).
-
-
Constructor Details
-
ColumnImpl
public ColumnImpl(Table table, String javaType, DatastoreIdentifier identifier, org.datanucleus.metadata.ColumnMetaData colmd) Constructor.- Parameters:
table- The table in the datastore that this column belongs to.javaType- The type of data being stored in this columnidentifier- The identifier of the column (in the datastore).colmd- The ColumnMetaData for this column
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceorg.datanucleus.store.schema.table.Column
-
getMemberColumnMapping
public org.datanucleus.store.schema.table.MemberColumnMapping getMemberColumnMapping()- Specified by:
getMemberColumnMappingin interfaceorg.datanucleus.store.schema.table.Column
-
getColumnType
public org.datanucleus.store.schema.naming.ColumnType getColumnType()- Specified by:
getColumnTypein interfaceorg.datanucleus.store.schema.table.Column
-
setJdbcType
- Specified by:
setJdbcTypein interfaceorg.datanucleus.store.schema.table.Column
-
getJdbcType
public org.datanucleus.metadata.JdbcType getJdbcType()- Specified by:
getJdbcTypein interfaceorg.datanucleus.store.schema.table.Column
-
setTypeName
-
getTypeName
- Specified by:
getTypeNamein interfaceorg.datanucleus.store.schema.table.Column
-
setPosition
- Specified by:
setPositionin interfaceorg.datanucleus.store.schema.table.Column
-
getPosition
public int getPosition()- Specified by:
getPositionin interfaceorg.datanucleus.store.schema.table.Column
-
isUnlimitedLength
public boolean isUnlimitedLength()Description copied from interface:ColumnConvenience method to check if the length is required to be unlimited (BLOB/CLOB).- Specified by:
isUnlimitedLengthin interfaceColumn- Returns:
- Whether unlimited length required.
-
getIdentifier
Description copied from interface:ColumnAccessor for the identifier for this object.- Specified by:
getIdentifierin interfaceColumn- Returns:
- The identifier.
-
setIdentifier
Description copied from interface:ColumnMutator for the identifier of the column.- Specified by:
setIdentifierin interfaceColumn- Parameters:
identifier- The identifier
-
getTable
-
getColumnMapping
Description copied from interface:ColumnAccessor for the column mapping that this column relates to.- Specified by:
getColumnMappingin interfaceColumn- Returns:
- The column mapping
-
setColumnMapping
Description copied from interface:ColumnMethod to associate this column with its mapping.- Specified by:
setColumnMappingin interfaceColumn- Parameters:
mapping- The mapping for this column
-
getJavaTypeMapping
Description copied from interface:ColumnAccessor for the JavaTypeMapping for the field/property that owns this column.- Specified by:
getJavaTypeMappingin interfaceColumn- Returns:
- The JavaTypeMapping
-
getStoredJavaType
Description copied from interface:ColumnAccessor for the type of data stored in this field.- Specified by:
getStoredJavaTypein interfaceColumn- Returns:
- The type of data in the field.
-
setTypeInfo
Description copied from interface:ColumnMutator for the type information of the column.- Specified by:
setTypeInfoin interfaceColumn- Parameters:
typeInfo- The type info- Returns:
- The column with the updated info
-
getTypeInfo
Description copied from interface:ColumnAccessor for the type info for this column.- Specified by:
getTypeInfoin interfaceColumn- Returns:
- The type info
-
getStoreManager
Description copied from interface:ColumnAccessor for the StoreManager for this column.- Specified by:
getStoreManagerin interfaceColumn- Returns:
- The StoreManager.
-
getSQLPrecision
private int getSQLPrecision()Accessor for the precision of data in the column.- Returns:
- The precision of data in the column
-
getSQLDefinition
Description copied from interface:ColumnAccessor for the SQL definition of this column.- Specified by:
getSQLDefinitionin interfaceColumn- Returns:
- The SQL definition of the column
-
getDefaultDefinition
Convenience method to return the "DEFAULT" part of the column definition.- Returns:
- The default part of the column definition.
-
initializeColumnInfoFromDatastore
Description copied from interface:ColumnInitialize the default column value and auto increment- Specified by:
initializeColumnInfoFromDatastorein interfaceColumn- Parameters:
ci- The column information
-
validate
Description copied from interface:ColumnMethod to validate the contents of the column. This method can throw IncompatibleDataTypeException, WrongScaleException, WrongPrecisionException, IsNullableException if the data in the column is not compatible with the supplied ColumnInfo. -
setCheckConstraints
Description copied from interface:ColumnMutator for the CHECK constraints of the column.- Specified by:
setCheckConstraintsin interfaceColumn- Parameters:
constraints- The constraints- Returns:
- The column with the updated info
-
setPrimaryKey
- Specified by:
setPrimaryKeyin interfaceorg.datanucleus.store.schema.table.Column
-
setNullable
- Specified by:
setNullablein interfaceorg.datanucleus.store.schema.table.Column
-
setDefaultable
-
setUnique
- Specified by:
setUniquein interfaceorg.datanucleus.store.schema.table.Column
-
setIdentity
Description copied from interface:ColumnMutator for whether we set this column as an identity column. An "identity" column is typically treated differently in the datastore being given a value by the datastore itself. In RDBMS this would mean that the column is "AUTO_INCREMENT", "SERIAL" etc- Specified by:
setIdentityin interfaceColumn- Parameters:
identity- True if column is identity- Returns:
- The Column
-
isPrimaryKey
public final boolean isPrimaryKey()- Specified by:
isPrimaryKeyin interfaceorg.datanucleus.store.schema.table.Column
-
isNullable
public final boolean isNullable()- Specified by:
isNullablein interfaceorg.datanucleus.store.schema.table.Column
-
isDefaultable
public final boolean isDefaultable()- Specified by:
isDefaultablein interfaceorg.datanucleus.store.schema.table.Column
-
isUnique
public final boolean isUnique()- Specified by:
isUniquein interfaceorg.datanucleus.store.schema.table.Column
-
isIdentity
public boolean isIdentity()Description copied from interface:ColumnAccessor for the whether this column is an identity column.- Specified by:
isIdentityin interfaceColumn- Returns:
- true if column is identity.
-
getDefaultValue
- Specified by:
getDefaultValuein interfaceorg.datanucleus.store.schema.table.Column
-
getColumnMetaData
public final org.datanucleus.metadata.ColumnMetaData getColumnMetaData()- Specified by:
getColumnMetaDatain interfaceorg.datanucleus.store.schema.table.Column
-
getMemberMetaData
public org.datanucleus.metadata.AbstractMemberMetaData getMemberMetaData()Description copied from interface:ColumnAccessor for the MetaData of the field/property that this is the column for.- Specified by:
getMemberMetaDatain interfaceColumn- Returns:
- MetaData of the field/property (if representing a field/property of a class).
-
setColumnMetaData
- Specified by:
setColumnMetaDatain interfaceorg.datanucleus.store.schema.table.Column
-
getCheckConstraints
Description copied from interface:ColumnAccessor for CHECK constraints for this column.- Specified by:
getCheckConstraintsin interfaceColumn- Returns:
- Returns any CHECK constraints.
-
checkPrimitive
Description copied from interface:ColumnChecks the column definition as a primitive.- Specified by:
checkPrimitivein interfaceColumn- Throws:
ColumnDefinitionException- if an error occurs
-
checkInteger
Description copied from interface:ColumnChecks the column definition as an integer.- Specified by:
checkIntegerin interfaceColumn- Throws:
ColumnDefinitionException- if an error occurs
-
checkDecimal
Description copied from interface:ColumnChecks the column definition as a decimal.- Specified by:
checkDecimalin interfaceColumn- Throws:
ColumnDefinitionException- if an error occurs
-
checkString
Description copied from interface:ColumnChecks the column definition as a string.- Specified by:
checkStringin interfaceColumn- Throws:
ColumnDefinitionException- if an error occurs
-
copyConfigurationTo
Description copied from interface:ColumnCopy the configuration of this field to another field- Specified by:
copyConfigurationToin interfaceColumn- Parameters:
colIn- the column to copy
-
applySelectFunction
Description copied from interface:ColumnWraps the column name with a FUNCTION.example: SQRT(?) generates: SQRT(columnName)
- Specified by:
applySelectFunctionin interfaceColumn- Parameters:
replacementValue- the replacement to ?. Probably it's a column name, that may be fully qualified name or not- Returns:
- a String with function taking as parameter the replacementValue
-
setWrapperFunction
Description copied from interface:ColumnSets a function to wrap the column. The wrapper function String must use "?" to be replaced later by the column name. For exampleSQRT(?) generates: SQRT(COLUMN)
- Specified by:
setWrapperFunctionin interfaceColumn- Parameters:
wrapperFunction- The wrapperFunction to set.wrapperMode- whether select, insert or update
-
getWrapperFunction
Description copied from interface:ColumnGets the wrapper for parameters.- Specified by:
getWrapperFunctionin interfaceColumn- Parameters:
wrapperMode- whether select, insert or update- Returns:
- Returns the wrapperFunction.
-
equals
-
hashCode
-
toString
-