|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jpox.store.rdbms.Column
public class Column
Definition of a Column in the datastore. Contains the full definition of the column, its type, size, whether it is autoincrement, nullable, part of the PK etc. The SQL column definition is generated here.
| Field Summary | |
|---|---|
protected boolean |
autoIncrement
Whether this is to use AUTOINCREMENT/IDENTITY. |
protected org.jpox.metadata.ColumnMetaData |
columnMetaData
ColumnMetaData for this column. |
protected java.lang.String |
constraints
Optional constraints to apply to this column in its SQL specification. |
protected org.jpox.store.mapped.mapping.DatastoreMapping |
datastoreMapping
Datastore mapping for this column. |
protected boolean |
defaultable
Whether this column should be defaulted on inserts. |
protected java.lang.Object |
defaultValue
Default value accepted by the datastore for this column, from DatabaseMetaData. |
protected int |
flags
|
protected org.jpox.store.mapped.DatastoreIdentifier |
identifier
Identifier for the column in the datastore. |
protected java.lang.String |
storedJavaType
Java type that this column is storing. |
protected org.jpox.store.mapped.MappedStoreManager |
storeMgr
Manager for the store into which we are persisting. |
protected org.jpox.store.mapped.DatastoreContainerObject |
table
Table containing this column in the datastore. |
protected TypeInfo |
typeInfo
Type info for the JDBC type being stored in this column |
static int |
WRAPPER_FUNCTION_INSERT
wrapper function insert |
static int |
WRAPPER_FUNCTION_SELECT
wrapper function select |
static int |
WRAPPER_FUNCTION_UPDATE
wrapper function update |
protected java.lang.String[] |
wrapperFunction
Function wrapping the column (for example, SQRT(COLUMN)). |
| Constructor Summary | |
|---|---|
Column(org.jpox.store.mapped.DatastoreContainerObject table,
java.lang.String javaType,
org.jpox.store.mapped.DatastoreIdentifier identifier,
org.jpox.metadata.ColumnMetaData colmd)
Constructor. |
|
| Method Summary | |
|---|---|
java.lang.String |
applySelectFunction(java.lang.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(org.jpox.store.mapped.DatastoreField field)
|
boolean |
equals(java.lang.Object obj)
Equality method. |
org.jpox.metadata.ColumnMetaData |
getColumnMetaData()
Accessor for the columnOptions |
java.lang.String |
getConstraints()
|
org.jpox.store.mapped.DatastoreContainerObject |
getDatastoreContainerObject()
Accessor for the DatastoreObject. |
org.jpox.store.mapped.mapping.DatastoreMapping |
getDatastoreMapping()
Accessor for the datastore mapping that this datastore field relates to. |
java.lang.Object |
getDefaultValue()
Accessor for the default Value |
org.jpox.metadata.AbstractMemberMetaData |
getFieldMetaData()
Accessor for the MetaData of the field that this is the datastore field for. |
org.jpox.store.mapped.DatastoreIdentifier |
getIdentifier()
Accessor for the identifier of the datastore column. |
int |
getJdbcType()
Accessor for the JDBC type being used for this Column |
org.jpox.store.mapped.mapping.JavaTypeMapping |
getMapping()
Accessor for the Mapping. |
org.jpox.metadata.MetaData |
getMetaData()
Access the metadata definition defining this DatastoreField. |
java.lang.String |
getSQLDefinition()
Accessor for the SQL definition of this column. |
java.lang.String |
getStoredJavaType()
Accessor for the type of data stored in this column. |
org.jpox.store.mapped.MappedStoreManager |
getStoreManager()
Accessor for the Store Manager. |
TypeInfo |
getTypeInfo()
Accessor for the type info for this column. |
java.lang.String |
getWrapperFunction(int wrapperMode)
Gets the wrapper for parameters |
int |
hashCode()
Accessor for the hashcode. |
void |
initializeColumnInfoFromDatastore(ColumnInfo ci)
Initialize the default column value and auto increment |
boolean |
isAutoIncrement()
Accessor for the AutoIncrement. |
boolean |
isDefaultable()
Accessor for whether the column is defaultable. |
boolean |
isExactPrecision()
Accessor for whether the column has exact precision. |
boolean |
isNullable()
Accessor for whether the column is nullable. |
boolean |
isPrimaryKey()
Accessor for whether the column is the primary key. |
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 column (part of) the primary key |
void |
setAutoIncrement(boolean auto_increment)
Mutator for whether we set this column as autoIncrement/identity. |
Column |
setConstraints(java.lang.String constraints)
Mutator for the constraints of the column. |
void |
setDatastoreMapping(org.jpox.store.mapped.mapping.DatastoreMapping mapping)
Method to associate this datastore field with its mapping. |
org.jpox.store.mapped.DatastoreField |
setDefaultable()
Mutator for the defaultability of the column. |
void |
setDefaultValue(java.lang.Object object)
Mutator for the default Value |
void |
setIdentifier(org.jpox.store.mapped.DatastoreIdentifier identifier)
Mutator for the identifier of the column. |
void |
setMetaData(org.jpox.metadata.MetaData md)
Method to update the MetaData for this datastore field. |
org.jpox.store.mapped.DatastoreField |
setNullable()
Mutator for the nullability of the column. |
Column |
setTypeInfo(TypeInfo typeInfo)
Mutator for the type information of the column. |
Column |
setUnique()
Mutator for the uniqueness of the column. |
void |
setWrapperFunction(java.lang.String wrapperFunction,
int wrapperMode)
Sets a function to wrap the column. |
java.lang.String |
toString()
Accessor for a string form of this Column. |
void |
validate(ColumnInfo ci)
Method to validate the contents of the column. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int WRAPPER_FUNCTION_SELECT
public static final int WRAPPER_FUNCTION_INSERT
public static final int WRAPPER_FUNCTION_UPDATE
protected org.jpox.store.mapped.DatastoreIdentifier identifier
protected org.jpox.metadata.ColumnMetaData columnMetaData
protected final org.jpox.store.mapped.DatastoreContainerObject table
protected org.jpox.store.mapped.mapping.DatastoreMapping datastoreMapping
protected final java.lang.String storedJavaType
protected final org.jpox.store.mapped.MappedStoreManager storeMgr
protected TypeInfo typeInfo
protected java.lang.String constraints
protected int flags
protected java.lang.Object defaultValue
protected boolean defaultable
protected boolean autoIncrement
protected java.lang.String[] wrapperFunction
| Constructor Detail |
|---|
public Column(org.jpox.store.mapped.DatastoreContainerObject table,
java.lang.String javaType,
org.jpox.store.mapped.DatastoreIdentifier identifier,
org.jpox.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 column| Method Detail |
|---|
public boolean isUnlimitedLength()
public org.jpox.store.mapped.DatastoreIdentifier getIdentifier()
getIdentifier in interface org.jpox.store.mapped.DatastoreObjectpublic void setIdentifier(org.jpox.store.mapped.DatastoreIdentifier identifier)
setIdentifier in interface org.jpox.store.mapped.DatastoreFieldidentifier - The identifierpublic org.jpox.store.mapped.DatastoreContainerObject getDatastoreContainerObject()
getDatastoreContainerObject in interface org.jpox.store.mapped.DatastoreFieldpublic org.jpox.store.mapped.mapping.DatastoreMapping getDatastoreMapping()
getDatastoreMapping in interface org.jpox.store.mapped.DatastoreFieldpublic void setDatastoreMapping(org.jpox.store.mapped.mapping.DatastoreMapping mapping)
setDatastoreMapping in interface org.jpox.store.mapped.DatastoreFieldmapping - The mapping for this datastore fieldpublic org.jpox.store.mapped.mapping.JavaTypeMapping getMapping()
getMapping in interface org.jpox.store.mapped.DatastoreFieldpublic java.lang.String getStoredJavaType()
getStoredJavaType in interface org.jpox.store.mapped.DatastoreFieldpublic final TypeInfo getTypeInfo()
public int getJdbcType()
public org.jpox.store.mapped.MappedStoreManager getStoreManager()
getStoreManager in interface org.jpox.store.mapped.DatastoreObjectpublic java.lang.String getSQLDefinition()
public void initializeColumnInfoFromDatastore(ColumnInfo ci)
ci - The column informationpublic void validate(ColumnInfo ci)
ci - The column information taken from the databasepublic final Column setTypeInfo(TypeInfo typeInfo)
typeInfo - The type info
public final Column setConstraints(java.lang.String constraints)
constraints - The constraints
public final void setAsPrimaryKey()
setAsPrimaryKey in interface org.jpox.store.mapped.DatastoreFieldpublic final org.jpox.store.mapped.DatastoreField setNullable()
setNullable in interface org.jpox.store.mapped.DatastoreFieldpublic final org.jpox.store.mapped.DatastoreField setDefaultable()
setDefaultable in interface org.jpox.store.mapped.DatastoreFieldpublic final Column setUnique()
public final boolean isPrimaryKey()
isPrimaryKey in interface org.jpox.store.mapped.DatastoreFieldpublic final boolean isExactPrecision()
public final boolean isNullable()
isNullable in interface org.jpox.store.mapped.DatastoreFieldpublic final boolean isDefaultable()
public final boolean isUnique()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - The Object to compare against
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String applySelectFunction(java.lang.String replacementValue)
example: SQRT(?) generates: SQRT(columnName)
applySelectFunction in interface org.jpox.store.mapped.DatastoreFieldreplacementValue - the replacement to ?. Probably it's a column name, that may be fully qualified name or not
public java.lang.Object getDefaultValue()
public void setDefaultValue(java.lang.Object object)
object - default valuepublic final org.jpox.metadata.ColumnMetaData getColumnMetaData()
public org.jpox.metadata.MetaData getMetaData()
getMetaData in interface org.jpox.store.mapped.DatastoreFieldpublic org.jpox.metadata.AbstractMemberMetaData getFieldMetaData()
getFieldMetaData in interface org.jpox.store.mapped.DatastoreFieldpublic void setMetaData(org.jpox.metadata.MetaData md)
setMetaData in interface org.jpox.store.mapped.DatastoreFieldmd - The MetaDatapublic java.lang.String getConstraints()
public boolean isAutoIncrement()
public void setAutoIncrement(boolean auto_increment)
auto_increment - True if column is autoincrement/identity
public final void checkPrimitive()
throws org.jpox.store.mapped.DatastoreFieldDefinitionException
org.jpox.store.mapped.DatastoreFieldDefinitionException
public final void checkInteger()
throws org.jpox.store.mapped.DatastoreFieldDefinitionException
org.jpox.store.mapped.DatastoreFieldDefinitionException
public final void checkDecimal()
throws org.jpox.store.mapped.DatastoreFieldDefinitionException
org.jpox.store.mapped.DatastoreFieldDefinitionException
public final void checkString()
throws org.jpox.store.mapped.DatastoreFieldDefinitionException
org.jpox.store.mapped.DatastoreFieldDefinitionExceptionpublic void copyConfigurationTo(org.jpox.store.mapped.DatastoreField field)
copyConfigurationTo in interface org.jpox.store.mapped.DatastoreField
public void setWrapperFunction(java.lang.String wrapperFunction,
int wrapperMode)
SQRT(?) generates: SQRT(COLUMN)
wrapperFunction - The wrapperFunction to set.wrapperMode - whether select, insert or updatepublic java.lang.String getWrapperFunction(int wrapperMode)
wrapperMode - whether select, insert or update
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||