public class ColumnImpl extends Object implements Column
Modifier and Type | Field and Description |
---|---|
protected org.datanucleus.metadata.ColumnMetaData |
columnMetaData
ColumnMetaData for this column.
|
protected String |
constraints
Optional constraints to apply to this column in its SQL specification.
|
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[] |
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) |
org.datanucleus.metadata.ColumnMetaData |
getColumnMetaData()
Access the metadata definition defining this column.
|
String |
getConstraints() |
DatastoreMapping |
getDatastoreMapping()
Accessor for the datastore mapping that this datastore field relates to.
|
Object |
getDefaultValue()
Accessor for the default Value
|
DatastoreIdentifier |
getIdentifier()
Accessor for the identifier for this object.
|
JavaTypeMapping |
getJavaTypeMapping()
Accessor for the JavaTypeMapping for the field/property that owns this column.
|
int |
getJdbcType()
Accessor for the JDBC type being used for this Column
|
org.datanucleus.metadata.AbstractMemberMetaData |
getMemberMetaData()
Accessor for the MetaData of the field/property that this is the datastore field 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 table.
|
Table |
getTable()
Accessor for the table for this column
|
SQLTypeInfo |
getTypeInfo()
Accessor for the type info for this column.
|
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()
Accessor for whether the column is defaultable.
|
boolean |
isIdentity()
Accessor for the whether this column is an identity column.
|
boolean |
isNullable()
Accessor for whether the field is nullable in the datastore.
|
boolean |
isPrimaryKey()
Accessor for whether the field is the primary key in the datastore.
|
boolean |
isUnique()
Accessor for whether the column is unique.
|
boolean |
isUnlimitedLength()
Convenience method to check if the length is required to be unlimited (BLOB/CLOB).
|
void |
setAsPrimaryKey()
Mutator to make the field the primary key.
|
void |
setColumnMetaData(org.datanucleus.metadata.ColumnMetaData colmd)
Method to set the MetaData for this datastore field.
|
Column |
setConstraints(String constraints)
Mutator for the constraints of the column.
|
void |
setDatastoreMapping(DatastoreMapping mapping)
Method to associate this datastore field with its mapping.
|
Column |
setDefaultable()
Mutator for the defaultability of the datastore field.
|
void |
setDefaultValue(Object object)
Mutator for the default Value
|
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 |
setNullable()
Mutator for the nullability of the datastore field.
|
Column |
setTypeInfo(SQLTypeInfo typeInfo)
Mutator for the type information of the column.
|
Column |
setUnique()
Mutator for the uniqueness of the column.
|
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 SQLTypeInfo typeInfo
protected String constraints
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 boolean isUnlimitedLength()
Column
isUnlimitedLength
in interface Column
public DatastoreIdentifier getIdentifier()
Column
getIdentifier
in interface Column
public void setIdentifier(DatastoreIdentifier identifier)
Column
setIdentifier
in interface Column
identifier
- The identifierpublic Table getTable()
Column
public DatastoreMapping getDatastoreMapping()
Column
getDatastoreMapping
in interface Column
public void setDatastoreMapping(DatastoreMapping mapping)
Column
setDatastoreMapping
in interface Column
mapping
- The mapping for this datastore fieldpublic JavaTypeMapping getJavaTypeMapping()
Column
getJavaTypeMapping
in interface Column
public String getStoredJavaType()
Column
getStoredJavaType
in interface Column
public final SQLTypeInfo getTypeInfo()
Column
getTypeInfo
in interface Column
public int getJdbcType()
Column
getJdbcType
in interface Column
public RDBMSStoreManager getStoreManager()
Column
getStoreManager
in interface Column
public String getSQLDefinition()
Column
getSQLDefinition
in interface Column
public void initializeColumnInfoFromDatastore(RDBMSColumnInfo ci)
Column
initializeColumnInfoFromDatastore
in interface Column
ci
- The column informationpublic void validate(RDBMSColumnInfo ci)
Column
public final Column setTypeInfo(SQLTypeInfo typeInfo)
Column
setTypeInfo
in interface Column
typeInfo
- The type infopublic final Column setConstraints(String constraints)
Column
setConstraints
in interface Column
constraints
- The constraintspublic final void setAsPrimaryKey()
Column
setAsPrimaryKey
in interface Column
public final Column setNullable()
Column
setNullable
in interface Column
public final Column setDefaultable()
Column
setDefaultable
in interface Column
public final Column setUnique()
Column
public Column setIdentity(boolean identity)
Column
setIdentity
in interface Column
identity
- True if column is identitypublic final boolean isPrimaryKey()
Column
isPrimaryKey
in interface Column
public final boolean isNullable()
Column
isNullable
in interface Column
public final boolean isDefaultable()
Column
isDefaultable
in interface Column
public final boolean isUnique()
Column
public boolean isIdentity()
Column
isIdentity
in interface Column
public String applySelectFunction(String replacementValue)
Column
example: SQRT(?) generates: SQRT(columnName)
applySelectFunction
in interface Column
replacementValue
- the replacement to ?. Probably it's a column name, that may be fully qualified name or notpublic Object getDefaultValue()
Column
getDefaultValue
in interface Column
public void setDefaultValue(Object object)
Column
setDefaultValue
in interface Column
object
- default valuepublic final org.datanucleus.metadata.ColumnMetaData getColumnMetaData()
Column
getColumnMetaData
in interface Column
public org.datanucleus.metadata.AbstractMemberMetaData getMemberMetaData()
Column
getMemberMetaData
in interface Column
public void setColumnMetaData(org.datanucleus.metadata.ColumnMetaData colmd)
Column
setColumnMetaData
in interface Column
colmd
- The MetaDatapublic String getConstraints()
getConstraints
in interface Column
public final void checkPrimitive() throws ColumnDefinitionException
Column
checkPrimitive
in interface Column
ColumnDefinitionException
public final void checkInteger() throws ColumnDefinitionException
Column
checkInteger
in interface Column
ColumnDefinitionException
public final void checkDecimal() throws ColumnDefinitionException
Column
checkDecimal
in interface Column
ColumnDefinitionException
public final void checkString() throws ColumnDefinitionException
Column
checkString
in interface Column
ColumnDefinitionException
public void copyConfigurationTo(Column colIn)
Column
copyConfigurationTo
in interface Column
colIn
- the column to copypublic void setWrapperFunction(String wrapperFunction, int wrapperMode)
Column
SQRT(?) generates: SQRT(COLUMN)
setWrapperFunction
in interface Column
wrapperFunction
- The wrapperFunction to set.wrapperMode
- whether select, insert or updatepublic String getWrapperFunction(int wrapperMode)
Column
getWrapperFunction
in interface Column
wrapperMode
- whether select, insert or updateCopyright © 2023. All rights reserved.