Interface Column
-
- All Superinterfaces:
org.datanucleus.store.schema.table.Column
- All Known Implementing Classes:
ColumnImpl
public interface Column extends org.datanucleus.store.schema.table.ColumnInterface for a column in an RDBMS datastore.
-
-
Field Summary
Fields Modifier and Type Field Description static intWRAPPER_FUNCTION_INSERTstatic intWRAPPER_FUNCTION_SELECTstatic intWRAPPER_FUNCTION_UPDATE
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringapplySelectFunction(String replacementValue)Wraps the column name with a FUNCTION.voidcheckDecimal()Checks the column definition as a decimal.voidcheckInteger()Checks the column definition as an integer.voidcheckPrimitive()Checks the column definition as a primitive.voidcheckString()Checks the column definition as a string.voidcopyConfigurationTo(Column col)Copy the configuration of this field to another fieldStringgetCheckConstraints()Accessor for CHECK constraints for this column.ColumnMappinggetColumnMapping()Accessor for the column mapping that this column relates to.DatastoreIdentifiergetIdentifier()Accessor for the identifier for this object.JavaTypeMappinggetJavaTypeMapping()Accessor for the JavaTypeMapping for the field/property that owns this column.org.datanucleus.metadata.AbstractMemberMetaDatagetMemberMetaData()Accessor for the MetaData of the field/property that this is the column for.StringgetSQLDefinition()Accessor for the SQL definition of this column.StringgetStoredJavaType()Accessor for the type of data stored in this field.RDBMSStoreManagergetStoreManager()Accessor for the StoreManager for this column.TablegetTable()Accessor for the table for this columnSQLTypeInfogetTypeInfo()Accessor for the type info for this column.StringgetWrapperFunction(int wrapperMode)Gets the wrapper for parameters.voidinitializeColumnInfoFromDatastore(RDBMSColumnInfo ci)Initialize the default column value and auto incrementbooleanisIdentity()Accessor for the whether this column is an identity column.booleanisUnlimitedLength()Convenience method to check if the length is required to be unlimited (BLOB/CLOB).ColumnsetCheckConstraints(String constraints)Mutator for the CHECK constraints of the column.voidsetColumnMapping(ColumnMapping mapping)Method to associate this column with its mapping.voidsetIdentifier(DatastoreIdentifier identifier)Mutator for the identifier of the column.ColumnsetIdentity(boolean identity)Mutator for whether we set this column as an identity column.ColumnsetTypeInfo(SQLTypeInfo typeInfo)Mutator for the type information of the column.voidsetWrapperFunction(String wrapperFunction, int wrapperMode)Sets a function to wrap the column.voidvalidate(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:
getTablein 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 ColumnDefinitionExceptionChecks the column definition as a primitive.- Throws:
ColumnDefinitionException- if an error occurs
-
checkInteger
void checkInteger() throws ColumnDefinitionExceptionChecks the column definition as an integer.- Throws:
ColumnDefinitionException- if an error occurs
-
checkDecimal
void checkDecimal() throws ColumnDefinitionExceptionChecks the column definition as a decimal.- Throws:
ColumnDefinitionException- if an error occurs
-
checkString
void checkString() throws ColumnDefinitionExceptionChecks 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.
-
-