|
||||||||||
| 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 java.lang.String |
constraints
Optional constraints to apply to this column in its SQL specification. |
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 DatastoreIdentifier |
identifier
Identifier for the column in the datastore. |
protected JavaTypeMapping |
mapping
Mapping for the java type being stored. |
protected java.lang.String |
storedJavaType
Java type that this column is storing. |
protected StoreManager |
storeMgr
Manager for the store into which we are persisting. |
protected 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(DatastoreContainerObject table,
java.lang.String javaType,
DatastoreIdentifier identifier,
JavaTypeMapping mapping,
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 |
void |
checkInteger()
Checks the column definition |
void |
checkPrimitive()
Checks the column definition |
void |
checkString()
Checks the column definition |
void |
copyConfigurationTo(DatastoreField field)
Copy the configuration of this field to another field |
boolean |
equals(java.lang.Object obj)
Equality method. |
ColumnMetaData |
getColumnMetaData()
Accessor for the columnOptions |
java.lang.String |
getConstraints()
|
DatastoreContainerObject |
getDatastoreContainerObject()
Accessor for the DatastoreObject. |
java.lang.Object |
getDefaultValue()
Accessor for the default Value |
ExtendableMetaData |
getExtendableMetaData()
Access the metadata definition for this DatastoreField. |
DatastoreIdentifier |
getIdentifier()
Accessor for the identifier of the datastore column. |
int |
getJdbcType()
Accessor for the JDBC type being used for this Column |
JavaTypeMapping |
getMapping()
Accessor for the Mapping. |
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. |
StoreManager |
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()
|
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. |
DatastoreField |
setDefaultable()
Mutator for the defaultability of the column. |
void |
setDefaultValue(java.lang.Object object)
Mutator for the default Value |
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()
|
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 |
|---|
protected final DatastoreIdentifier identifier
protected final DatastoreContainerObject table
protected final JavaTypeMapping mapping
protected final java.lang.String storedJavaType
protected final StoreManager 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
public static final int WRAPPER_FUNCTION_SELECT
public static final int WRAPPER_FUNCTION_INSERT
public static final int WRAPPER_FUNCTION_UPDATE
| Constructor Detail |
|---|
public Column(DatastoreContainerObject table,
java.lang.String javaType,
DatastoreIdentifier identifier,
JavaTypeMapping mapping,
ColumnMetaData colmd)
table - The table in the datastore that this column belongs to.javaType - The type of data being stored in this columnmapping - The mapping owning this columnidentifier - The identifier of the column (in the datastore).colmd - The ColumnMetaData for this column| Method Detail |
|---|
public boolean isUnlimitedLength()
public DatastoreIdentifier getIdentifier()
getIdentifier in interface DatastoreObjectpublic DatastoreContainerObject getDatastoreContainerObject()
getDatastoreContainerObject in interface DatastoreFieldpublic JavaTypeMapping getMapping()
getMapping in interface DatastoreFieldpublic java.lang.String getStoredJavaType()
getStoredJavaType in interface DatastoreFieldpublic final TypeInfo getTypeInfo()
public int getJdbcType()
public StoreManager getStoreManager()
getStoreManager in interface DatastoreObjectpublic java.lang.String getSQLDefinition()
public void initializeColumnInfoFromDatastore(ColumnInfo ci)
ci - The column informationpublic void validate(ColumnInfo ci)
ci - The column informationpublic 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 DatastoreFieldpublic final DatastoreField setNullable()
setNullable in interface DatastoreFieldpublic final DatastoreField setDefaultable()
setDefaultable in interface DatastoreFieldpublic final Column setUnique()
public final boolean isPrimaryKey()
isPrimaryKey in interface DatastoreFieldpublic final boolean isExactPrecision()
public final boolean isNullable()
isNullable in interface 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 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 ColumnMetaData getColumnMetaData()
public ExtendableMetaData getExtendableMetaData()
getExtendableMetaData in interface DatastoreFieldpublic 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 DatastoreFieldDefinitionException
DatastoreFieldDefinitionException
public final void checkInteger()
throws DatastoreFieldDefinitionException
DatastoreFieldDefinitionException
public final void checkDecimal()
throws DatastoreFieldDefinitionException
DatastoreFieldDefinitionException
public final void checkString()
throws DatastoreFieldDefinitionException
DatastoreFieldDefinitionExceptionpublic void copyConfigurationTo(DatastoreField field)
DatastoreField
copyConfigurationTo in interface DatastoreFieldfield - the datastore field
public void setWrapperFunction(java.lang.String wrapperFunction,
int wrapperMode)
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 | |||||||||