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
Fields Modifier and Type Field Description static int
WRAPPER_FUNCTION_INSERT
static int
WRAPPER_FUNCTION_SELECT
static int
WRAPPER_FUNCTION_UPDATE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
applySelectFunction(String replacementValue)
Wraps the column name with a FUNCTION.void
checkDecimal()
Checks the column definition as a decimal.void
checkInteger()
Checks the column definition as an integer.void
checkPrimitive()
Checks the column definition as a primitive.void
checkString()
Checks the column definition as a string.void
copyConfigurationTo(Column col)
Copy the configuration of this field to another fieldString
getCheckConstraints()
Accessor for CHECK constraints for this column.ColumnMapping
getColumnMapping()
Accessor for the column mapping that this column relates to.DatastoreIdentifier
getIdentifier()
Accessor for the identifier for this object.JavaTypeMapping
getJavaTypeMapping()
Accessor for the JavaTypeMapping for the field/property that owns this column.org.datanucleus.metadata.AbstractMemberMetaData
getMemberMetaData()
Accessor for the MetaData of the field/property that this is the column for.String
getSQLDefinition()
Accessor for the SQL definition of this column.String
getStoredJavaType()
Accessor for the type of data stored in this field.RDBMSStoreManager
getStoreManager()
Accessor for the StoreManager for this column.Table
getTable()
Accessor for the table for this columnSQLTypeInfo
getTypeInfo()
Accessor for the type info for this column.String
getWrapperFunction(int wrapperMode)
Gets the wrapper for parameters.void
initializeColumnInfoFromDatastore(RDBMSColumnInfo ci)
Initialize the default column value and auto incrementboolean
isIdentity()
Accessor for the whether this column is an identity column.boolean
isUnlimitedLength()
Convenience method to check if the length is required to be unlimited (BLOB/CLOB).Column
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.Column
setIdentity(boolean identity)
Mutator for whether we set this column as an identity column.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
validate(RDBMSColumnInfo ci)
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 Detail
-
WRAPPER_FUNCTION_SELECT
static final int WRAPPER_FUNCTION_SELECT
- See Also:
- Constant Field Values
-
WRAPPER_FUNCTION_INSERT
static final int WRAPPER_FUNCTION_INSERT
- See Also:
- Constant Field Values
-
WRAPPER_FUNCTION_UPDATE
static final int WRAPPER_FUNCTION_UPDATE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
void setIdentifier(DatastoreIdentifier identifier)
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
Column setIdentity(boolean identity)
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
void setColumnMapping(ColumnMapping mapping)
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
void copyConfigurationTo(Column col)
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
Column setTypeInfo(SQLTypeInfo typeInfo)
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
void initializeColumnInfoFromDatastore(RDBMSColumnInfo ci)
Initialize the default column value and auto increment- Parameters:
ci
- The column information
-
validate
void validate(RDBMSColumnInfo ci)
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
Column setCheckConstraints(String constraints)
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
void checkPrimitive() throws ColumnDefinitionException
Checks the column definition as a primitive.- Throws:
ColumnDefinitionException
- if an error occurs
-
checkInteger
void checkInteger() throws ColumnDefinitionException
Checks the column definition as an integer.- Throws:
ColumnDefinitionException
- if an error occurs
-
checkDecimal
void checkDecimal() throws ColumnDefinitionException
Checks the column definition as a decimal.- Throws:
ColumnDefinitionException
- if an error occurs
-
checkString
void checkString() throws ColumnDefinitionException
Checks the column definition as a string.- Throws:
ColumnDefinitionException
- if an error occurs
-
applySelectFunction
String applySelectFunction(String replacementValue)
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
void setWrapperFunction(String wrapperFunction, int wrapperMode)
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
String getWrapperFunction(int wrapperMode)
Gets the wrapper for parameters.- Parameters:
wrapperMode
- whether select, insert or update- Returns:
- Returns the wrapperFunction.
-
-