Interface Column
- All Superinterfaces:
org.datanucleus.store.schema.table.Column
- All Known Implementing Classes:
ColumnImpl
public interface Column
extends org.datanucleus.store.schema.table.Column
Interface for a column in an RDBMS datastore.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionapplySelectFunction
(String replacementValue) Wraps the column name with a FUNCTION.void
Checks the column definition as a decimal.void
Checks the column definition as an integer.void
Checks the column definition as a primitive.void
Checks the column definition as a string.void
Copy the configuration of this field to another fieldAccessor for CHECK constraints for this column.Accessor for the column mapping that this column relates to.Accessor for the identifier for this object.Accessor for the JavaTypeMapping for the field/property that owns this column.org.datanucleus.metadata.AbstractMemberMetaData
Accessor for the MetaData of the field/property that this is the column for.Accessor for the SQL definition of this 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 columnAccessor for the type info for this column.getWrapperFunction
(int wrapperMode) Gets the wrapper for parameters.void
Initialize the default column value and auto incrementboolean
Accessor for the whether this column is an identity column.boolean
Convenience method to check if the length is required to be unlimited (BLOB/CLOB).setCheckConstraints
(String constraints) Mutator for the CHECK constraints of the column.void
setColumnMapping
(ColumnMapping mapping) Method to associate this column with its mapping.void
setIdentifier
(DatastoreIdentifier identifier) Mutator for the identifier of the column.setIdentity
(boolean identity) Mutator for whether we set this column as an identity column.setTypeInfo
(SQLTypeInfo typeInfo) Mutator for the type information of the column.void
setWrapperFunction
(String wrapperFunction, int wrapperMode) Sets a function to wrap the column.void
Method to validate the contents of the column.Methods inherited from interface org.datanucleus.store.schema.table.Column
getColumnMetaData, getColumnType, getDefaultValue, getJdbcType, getMemberColumnMapping, getName, getPosition, getTypeName, isDefaultable, isNullable, isPrimaryKey, isUnique, setColumnMetaData, setDefaultable, setJdbcType, setNullable, setPosition, setPrimaryKey, setTypeName, setUnique
-
Field Details
-
WRAPPER_FUNCTION_SELECT
static final int WRAPPER_FUNCTION_SELECT- See Also:
-
WRAPPER_FUNCTION_INSERT
static final int WRAPPER_FUNCTION_INSERT- See Also:
-
WRAPPER_FUNCTION_UPDATE
static final int WRAPPER_FUNCTION_UPDATE- See Also:
-
-
Method Details
-
getStoreManager
RDBMSStoreManager getStoreManager()Accessor for the StoreManager for this column.- Returns:
- The StoreManager.
-
getTable
Table getTable()Accessor for the table for this column- Specified by:
getTable
in interfaceorg.datanucleus.store.schema.table.Column
- Returns:
- The table
-
getStoredJavaType
String getStoredJavaType()Accessor for the type of data stored in this field.- Returns:
- The type of data in the field.
-
setIdentifier
Mutator for the identifier of the column.- Parameters:
identifier
- The identifier
-
getIdentifier
DatastoreIdentifier getIdentifier()Accessor for the identifier for this object.- Returns:
- The identifier.
-
setIdentity
Mutator 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- Parameters:
identity
- True if column is identity- Returns:
- The Column
-
isIdentity
boolean isIdentity()Accessor for the whether this column is an identity column.- Returns:
- true if column is identity.
-
setColumnMapping
Method to associate this column with its mapping.- Parameters:
mapping
- The mapping for this column
-
getColumnMapping
ColumnMapping getColumnMapping()Accessor for the column mapping that this column relates to.- Returns:
- The column mapping
-
getJavaTypeMapping
JavaTypeMapping getJavaTypeMapping()Accessor for the JavaTypeMapping for the field/property that owns this column.- Returns:
- The JavaTypeMapping
-
copyConfigurationTo
Copy the configuration of this field to another field- Parameters:
col
- the column to copy
-
getMemberMetaData
org.datanucleus.metadata.AbstractMemberMetaData getMemberMetaData()Accessor for the MetaData of the field/property that this is the column for.- Returns:
- MetaData of the field/property (if representing a field/property of a class).
-
isUnlimitedLength
boolean isUnlimitedLength()Convenience method to check if the length is required to be unlimited (BLOB/CLOB).- Returns:
- Whether unlimited length required.
-
setTypeInfo
Mutator for the type information of the column.- Parameters:
typeInfo
- The type info- Returns:
- The column with the updated info
-
getTypeInfo
SQLTypeInfo getTypeInfo()Accessor for the type info for this column.- Returns:
- The type info
-
getSQLDefinition
String getSQLDefinition()Accessor for the SQL definition of this column.- Returns:
- The SQL definition of the column
-
initializeColumnInfoFromDatastore
Initialize the default column value and auto increment- Parameters:
ci
- The column information
-
validate
Method 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.- Parameters:
ci
- The column information taken from the database
-
setCheckConstraints
Mutator for the CHECK constraints of the column.- Parameters:
constraints
- The constraints- Returns:
- The column with the updated info
-
getCheckConstraints
String getCheckConstraints()Accessor for CHECK constraints for this column.- Returns:
- Returns any CHECK constraints.
-
checkPrimitive
Checks the column definition as a primitive.- Throws:
ColumnDefinitionException
- if an error occurs
-
checkInteger
Checks the column definition as an integer.- Throws:
ColumnDefinitionException
- if an error occurs
-
checkDecimal
Checks the column definition as a decimal.- Throws:
ColumnDefinitionException
- if an error occurs
-
checkString
Checks the column definition as a string.- Throws:
ColumnDefinitionException
- if an error occurs
-
applySelectFunction
Wraps the column name with a FUNCTION.example: SQRT(?) generates: SQRT(columnName)
- 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
Sets 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)
- Parameters:
wrapperFunction
- The wrapperFunction to set.wrapperMode
- whether select, insert or update
-
getWrapperFunction
Gets the wrapper for parameters.- Parameters:
wrapperMode
- whether select, insert or update- Returns:
- Returns the wrapperFunction.
-