public class ColumnImpl extends Object implements Column
| Modifier and Type | Field and Description |
|---|---|
protected String |
checkConstraints
CHECK constraints to apply to this column in its SQL specification (optional).
|
protected org.datanucleus.metadata.ColumnMetaData |
columnMetaData
ColumnMetaData for this column.
|
protected DatastoreMapping |
datastoreMapping
Datastore mapping for this column.
|
protected Object |
defaultValue
Default value accepted by the datastore for this column, from DatabaseMetaData.
|
protected byte |
flags
Operational flags, for nullability, PK, autoinc, etc.
|
protected DatastoreIdentifier |
identifier
Identifier for the column in the datastore.
|
protected String |
storedJavaType
Java type that this column is storing.
|
protected Table |
table
Table containing this column in the datastore.
|
protected SQLTypeInfo |
typeInfo
SQL Type info for the JDBC type being stored in this column
|
protected String |
typeName
Manual override of the type name for this column (optional).
|
protected String[] |
wrapperFunction
Function wrapping the column (for example, SQRT(COLUMN)).
|
WRAPPER_FUNCTION_INSERT, WRAPPER_FUNCTION_SELECT, WRAPPER_FUNCTION_UPDATE| Constructor and Description |
|---|
ColumnImpl(Table table,
String javaType,
DatastoreIdentifier identifier,
org.datanucleus.metadata.ColumnMetaData colmd)
Constructor.
|
| Modifier and Type | Method and 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 colIn)
Copy the configuration of this field to another field
|
boolean |
equals(Object obj) |
String |
getCheckConstraints()
Accessor for CHECK constraints for this column.
|
org.datanucleus.metadata.ColumnMetaData |
getColumnMetaData() |
org.datanucleus.store.schema.naming.ColumnType |
getColumnType() |
DatastoreMapping |
getDatastoreMapping()
Accessor for the datastore mapping that this datastore field relates to.
|
Object |
getDefaultValue() |
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.JdbcType |
getJdbcType() |
org.datanucleus.store.schema.table.MemberColumnMapping |
getMemberColumnMapping() |
org.datanucleus.metadata.AbstractMemberMetaData |
getMemberMetaData()
Accessor for the MetaData of the field/property that this is the datastore field for.
|
String |
getName() |
int |
getPosition() |
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 column
|
SQLTypeInfo |
getTypeInfo()
Accessor for the type info for this column.
|
String |
getTypeName() |
String |
getWrapperFunction(int wrapperMode)
Gets the wrapper for parameters.
|
int |
hashCode() |
void |
initializeColumnInfoFromDatastore(RDBMSColumnInfo ci)
Initialize the default column value and auto increment
|
boolean |
isDefaultable() |
boolean |
isIdentity()
Accessor for the whether this column is an identity column.
|
boolean |
isNullable() |
boolean |
isPrimaryKey() |
boolean |
isUnique() |
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.
|
Column |
setColumnMetaData(org.datanucleus.metadata.ColumnMetaData colmd) |
void |
setDatastoreMapping(DatastoreMapping mapping)
Method to associate this datastore field with its mapping.
|
Column |
setDefaultable(Object defaultValue) |
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 |
setJdbcType(org.datanucleus.metadata.JdbcType jdbcType) |
Column |
setNullable(boolean flag) |
Column |
setPosition(int pos) |
Column |
setPrimaryKey() |
Column |
setTypeInfo(SQLTypeInfo typeInfo)
Mutator for the type information of the column.
|
Column |
setTypeName(String type) |
Column |
setUnique(boolean flag) |
void |
setWrapperFunction(String wrapperFunction,
int wrapperMode)
Sets a function to wrap the column.
|
String |
toString() |
void |
validate(RDBMSColumnInfo ci)
Method to validate the contents of the column.
|
protected DatastoreIdentifier identifier
protected org.datanucleus.metadata.ColumnMetaData columnMetaData
protected final Table table
protected DatastoreMapping datastoreMapping
protected final String storedJavaType
protected String typeName
protected SQLTypeInfo typeInfo
protected String checkConstraints
protected byte flags
protected Object defaultValue
protected String[] wrapperFunction
public ColumnImpl(Table table, String javaType, DatastoreIdentifier identifier, org.datanucleus.metadata.ColumnMetaData colmd)
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 columnpublic String getName()
getName in interface org.datanucleus.store.schema.table.Columnpublic org.datanucleus.store.schema.table.MemberColumnMapping getMemberColumnMapping()
getMemberColumnMapping in interface org.datanucleus.store.schema.table.Columnpublic org.datanucleus.store.schema.naming.ColumnType getColumnType()
getColumnType in interface org.datanucleus.store.schema.table.Columnpublic Column setJdbcType(org.datanucleus.metadata.JdbcType jdbcType)
setJdbcType in interface org.datanucleus.store.schema.table.Columnpublic org.datanucleus.metadata.JdbcType getJdbcType()
getJdbcType in interface org.datanucleus.store.schema.table.Columnpublic Column setTypeName(String type)
setTypeName in interface org.datanucleus.store.schema.table.Columnpublic String getTypeName()
getTypeName in interface org.datanucleus.store.schema.table.Columnpublic Column setPosition(int pos)
setPosition in interface org.datanucleus.store.schema.table.Columnpublic int getPosition()
getPosition in interface org.datanucleus.store.schema.table.Columnpublic boolean isUnlimitedLength()
Columnpublic DatastoreIdentifier getIdentifier()
Columnpublic void setIdentifier(DatastoreIdentifier identifier)
Columnidentifier - The identifierpublic Table getTable()
ColumngetTable in interface org.datanucleus.store.schema.table.Columnpublic DatastoreMapping getDatastoreMapping()
Columnpublic void setDatastoreMapping(DatastoreMapping mapping)
Columnmapping - The mapping for this datastore fieldpublic JavaTypeMapping getJavaTypeMapping()
Columnpublic String getStoredJavaType()
Columnpublic final Column setTypeInfo(SQLTypeInfo typeInfo)
ColumntypeInfo - The type infopublic final SQLTypeInfo getTypeInfo()
Columnpublic RDBMSStoreManager getStoreManager()
Columnpublic String getSQLDefinition()
Columnpublic void initializeColumnInfoFromDatastore(RDBMSColumnInfo ci)
Columnci - The column informationpublic void validate(RDBMSColumnInfo ci)
Columnci - The column information taken from the databasepublic final Column setCheckConstraints(String constraints)
Columnconstraints - The constraintspublic final Column setPrimaryKey()
setPrimaryKey in interface org.datanucleus.store.schema.table.Columnpublic final Column setNullable(boolean flag)
setNullable in interface org.datanucleus.store.schema.table.Columnpublic final Column setDefaultable(Object defaultValue)
setDefaultable in interface org.datanucleus.store.schema.table.Columnpublic final Column setUnique(boolean flag)
setUnique in interface org.datanucleus.store.schema.table.Columnpublic Column setIdentity(boolean identity)
Columnidentity - True if column is identitypublic final boolean isPrimaryKey()
isPrimaryKey in interface org.datanucleus.store.schema.table.Columnpublic final boolean isNullable()
isNullable in interface org.datanucleus.store.schema.table.Columnpublic final boolean isDefaultable()
isDefaultable in interface org.datanucleus.store.schema.table.Columnpublic final boolean isUnique()
isUnique in interface org.datanucleus.store.schema.table.Columnpublic boolean isIdentity()
Columnpublic Object getDefaultValue()
getDefaultValue in interface org.datanucleus.store.schema.table.Columnpublic final org.datanucleus.metadata.ColumnMetaData getColumnMetaData()
getColumnMetaData in interface org.datanucleus.store.schema.table.Columnpublic org.datanucleus.metadata.AbstractMemberMetaData getMemberMetaData()
Columnpublic Column setColumnMetaData(org.datanucleus.metadata.ColumnMetaData colmd)
setColumnMetaData in interface org.datanucleus.store.schema.table.Columnpublic String getCheckConstraints()
Columnpublic final void checkPrimitive()
throws ColumnDefinitionException
ColumnColumnDefinitionException - if an error occurspublic final void checkInteger()
throws ColumnDefinitionException
ColumnColumnDefinitionException - if an error occurspublic final void checkDecimal()
throws ColumnDefinitionException
ColumnColumnDefinitionException - if an error occurspublic final void checkString()
throws ColumnDefinitionException
ColumnColumnDefinitionException - if an error occurspublic void copyConfigurationTo(Column colIn)
ColumncolIn - the column to copypublic String applySelectFunction(String replacementValue)
Columnexample: SQRT(?) generates: SQRT(columnName)
replacementValue - the replacement to ?. Probably it's a column name, that may be fully qualified name or notpublic void setWrapperFunction(String wrapperFunction, int wrapperMode)
ColumnSQRT(?) generates: SQRT(COLUMN)
wrapperFunction - The wrapperFunction to set.wrapperMode - whether select, insert or updatepublic String getWrapperFunction(int wrapperMode)
ColumnwrapperMode - whether select, insert or updateCopyright © 2019. All rights reserved.