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() |
org.datanucleus.store.schema.naming.ColumnType |
getColumnType() |
String |
getConstraints() |
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 |
setColumnMetaData(org.datanucleus.metadata.ColumnMetaData colmd) |
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(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 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 String getName()
getName
in interface org.datanucleus.store.schema.table.Column
public org.datanucleus.store.schema.table.MemberColumnMapping getMemberColumnMapping()
getMemberColumnMapping
in interface org.datanucleus.store.schema.table.Column
public org.datanucleus.store.schema.naming.ColumnType getColumnType()
getColumnType
in interface org.datanucleus.store.schema.table.Column
public Column setJdbcType(org.datanucleus.metadata.JdbcType jdbcType)
setJdbcType
in interface org.datanucleus.store.schema.table.Column
public org.datanucleus.metadata.JdbcType getJdbcType()
getJdbcType
in interface org.datanucleus.store.schema.table.Column
public Column setTypeName(String type)
setTypeName
in interface org.datanucleus.store.schema.table.Column
public String getTypeName()
getTypeName
in interface org.datanucleus.store.schema.table.Column
public Column setPosition(int pos)
setPosition
in interface org.datanucleus.store.schema.table.Column
public int getPosition()
getPosition
in interface org.datanucleus.store.schema.table.Column
public boolean isUnlimitedLength()
Column
public DatastoreIdentifier getIdentifier()
Column
public void setIdentifier(DatastoreIdentifier identifier)
Column
identifier
- The identifierpublic Table getTable()
Column
getTable
in interface org.datanucleus.store.schema.table.Column
public DatastoreMapping getDatastoreMapping()
Column
public void setDatastoreMapping(DatastoreMapping mapping)
Column
mapping
- The mapping for this datastore fieldpublic JavaTypeMapping getJavaTypeMapping()
Column
public String getStoredJavaType()
Column
public final Column setTypeInfo(SQLTypeInfo typeInfo)
Column
typeInfo
- The type infopublic final SQLTypeInfo getTypeInfo()
Column
public RDBMSStoreManager getStoreManager()
Column
public String getSQLDefinition()
Column
public void initializeColumnInfoFromDatastore(RDBMSColumnInfo ci)
Column
ci
- The column informationpublic void validate(RDBMSColumnInfo ci)
Column
ci
- The column information taken from the databasepublic final Column setConstraints(String constraints)
Column
constraints
- The constraintspublic final Column setPrimaryKey()
setPrimaryKey
in interface org.datanucleus.store.schema.table.Column
public final Column setNullable(boolean flag)
setNullable
in interface org.datanucleus.store.schema.table.Column
public final Column setDefaultable(Object defaultValue)
setDefaultable
in interface org.datanucleus.store.schema.table.Column
public final Column setUnique(boolean flag)
setUnique
in interface org.datanucleus.store.schema.table.Column
public Column setIdentity(boolean identity)
Column
identity
- True if column is identitypublic final boolean isPrimaryKey()
isPrimaryKey
in interface org.datanucleus.store.schema.table.Column
public final boolean isNullable()
isNullable
in interface org.datanucleus.store.schema.table.Column
public final boolean isDefaultable()
isDefaultable
in interface org.datanucleus.store.schema.table.Column
public final boolean isUnique()
isUnique
in interface org.datanucleus.store.schema.table.Column
public boolean isIdentity()
Column
public String applySelectFunction(String replacementValue)
Column
example: SQRT(?) generates: SQRT(columnName)
replacementValue
- the replacement to ?. Probably it's a column name, that may be fully qualified name or notpublic Object getDefaultValue()
getDefaultValue
in interface org.datanucleus.store.schema.table.Column
public final org.datanucleus.metadata.ColumnMetaData getColumnMetaData()
getColumnMetaData
in interface org.datanucleus.store.schema.table.Column
public org.datanucleus.metadata.AbstractMemberMetaData getMemberMetaData()
Column
public Column setColumnMetaData(org.datanucleus.metadata.ColumnMetaData colmd)
setColumnMetaData
in interface org.datanucleus.store.schema.table.Column
public String getConstraints()
public final void checkPrimitive() throws ColumnDefinitionException
Column
ColumnDefinitionException
- if an error occurspublic final void checkInteger() throws ColumnDefinitionException
Column
ColumnDefinitionException
- if an error occurspublic final void checkDecimal() throws ColumnDefinitionException
Column
ColumnDefinitionException
- if an error occurspublic final void checkString() throws ColumnDefinitionException
Column
ColumnDefinitionException
- if an error occurspublic void copyConfigurationTo(Column colIn)
Column
colIn
- the column to copypublic void setWrapperFunction(String wrapperFunction, int wrapperMode)
Column
SQRT(?) generates: SQRT(COLUMN)
wrapperFunction
- The wrapperFunction to set.wrapperMode
- whether select, insert or updatepublic String getWrapperFunction(int wrapperMode)
Column
wrapperMode
- whether select, insert or updateCopyright © 2015. All rights reserved.