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()
ColumnisUnlimitedLength in interface Columnpublic DatastoreIdentifier getIdentifier()
ColumngetIdentifier in interface Columnpublic void setIdentifier(DatastoreIdentifier identifier)
ColumnsetIdentifier in interface Columnidentifier - The identifierpublic Table getTable()
Columnpublic DatastoreMapping getDatastoreMapping()
ColumngetDatastoreMapping in interface Columnpublic void setDatastoreMapping(DatastoreMapping mapping)
ColumnsetDatastoreMapping in interface Columnmapping - The mapping for this datastore fieldpublic JavaTypeMapping getJavaTypeMapping()
ColumngetJavaTypeMapping in interface Columnpublic String getStoredJavaType()
ColumngetStoredJavaType in interface Columnpublic final SQLTypeInfo getTypeInfo()
ColumngetTypeInfo in interface Columnpublic int getJdbcType()
ColumngetJdbcType in interface Columnpublic RDBMSStoreManager getStoreManager()
ColumngetStoreManager in interface Columnpublic String getSQLDefinition()
ColumngetSQLDefinition in interface Columnpublic void initializeColumnInfoFromDatastore(RDBMSColumnInfo ci)
ColumninitializeColumnInfoFromDatastore in interface Columnci - The column informationpublic void validate(RDBMSColumnInfo ci)
Columnpublic final Column setTypeInfo(SQLTypeInfo typeInfo)
ColumnsetTypeInfo in interface ColumntypeInfo - The type infopublic final Column setConstraints(String constraints)
ColumnsetConstraints in interface Columnconstraints - The constraintspublic final void setAsPrimaryKey()
ColumnsetAsPrimaryKey in interface Columnpublic final Column setNullable()
ColumnsetNullable in interface Columnpublic final Column setDefaultable()
ColumnsetDefaultable in interface Columnpublic final Column setUnique()
Columnpublic Column setIdentity(boolean identity)
ColumnsetIdentity in interface Columnidentity - True if column is identitypublic final boolean isPrimaryKey()
ColumnisPrimaryKey in interface Columnpublic final boolean isNullable()
ColumnisNullable in interface Columnpublic final boolean isDefaultable()
ColumnisDefaultable in interface Columnpublic final boolean isUnique()
Columnpublic boolean isIdentity()
ColumnisIdentity in interface Columnpublic String applySelectFunction(String replacementValue)
Columnexample: SQRT(?) generates: SQRT(columnName)
applySelectFunction in interface ColumnreplacementValue - the replacement to ?. Probably it's a column name, that may be fully qualified name or notpublic Object getDefaultValue()
ColumngetDefaultValue in interface Columnpublic void setDefaultValue(Object object)
ColumnsetDefaultValue in interface Columnobject - default valuepublic final org.datanucleus.metadata.ColumnMetaData getColumnMetaData()
ColumngetColumnMetaData in interface Columnpublic org.datanucleus.metadata.AbstractMemberMetaData getMemberMetaData()
ColumngetMemberMetaData in interface Columnpublic void setColumnMetaData(org.datanucleus.metadata.ColumnMetaData colmd)
ColumnsetColumnMetaData in interface Columncolmd - The MetaDatapublic String getConstraints()
getConstraints in interface Columnpublic final void checkPrimitive()
throws ColumnDefinitionException
ColumncheckPrimitive in interface ColumnColumnDefinitionExceptionpublic final void checkInteger()
throws ColumnDefinitionException
ColumncheckInteger in interface ColumnColumnDefinitionExceptionpublic final void checkDecimal()
throws ColumnDefinitionException
ColumncheckDecimal in interface ColumnColumnDefinitionExceptionpublic final void checkString()
throws ColumnDefinitionException
ColumncheckString in interface ColumnColumnDefinitionExceptionpublic void copyConfigurationTo(Column colIn)
ColumncopyConfigurationTo in interface ColumncolIn - the column to copypublic void setWrapperFunction(String wrapperFunction, int wrapperMode)
ColumnSQRT(?) generates: SQRT(COLUMN)
setWrapperFunction in interface ColumnwrapperFunction - The wrapperFunction to set.wrapperMode - whether select, insert or updatepublic String getWrapperFunction(int wrapperMode)
ColumngetWrapperFunction in interface ColumnwrapperMode - whether select, insert or updateCopyright © 2013. All Rights Reserved.