|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.empire.db.DBObject
org.apache.empire.db.DBExpr
org.apache.empire.db.DBColumnExpr
org.apache.empire.db.DBColumn
org.apache.empire.db.DBTableColumn
public class DBTableColumn
This class represent one column of a table. It contains all properties of this columns (e.g. the column width).
Field Summary | |
---|---|
protected DataMode |
dataMode
|
protected Object |
defValue
|
protected double |
size
|
protected DataType |
type
|
Fields inherited from class org.apache.empire.db.DBColumn |
---|
comment, DBCOLATTR_DATETIMEPATTERN, DBCOLATTR_MANDATORY, DBCOLATTR_MAXVALUE, DBCOLATTR_MINVALUE, DBCOLATTR_READONLY, DBCOLATTR_SINGLEBYTECHARS, name, rowset |
Fields inherited from class org.apache.empire.db.DBColumnExpr |
---|
attributes, beanPropertyName, DBCOLATTR_TITLE, DBCOLATTR_TYPE, options |
Fields inherited from class org.apache.empire.db.DBExpr |
---|
CTX_ALIAS, CTX_ALL, CTX_DEFAULT, CTX_FULLNAME, CTX_NAME, CTX_NOPARENTHESES, CTX_VALUE |
Constructor Summary | |
---|---|
|
DBTableColumn(DBTable table,
DataType type,
String name,
double size,
DataMode dataMode,
Object defValue)
Constructs a DBTableColumn object set the specified parameters to this object. |
protected |
DBTableColumn(DBTable newTable,
DBTableColumn other)
Clone Constructor - use clone() |
Method Summary | |
---|---|
Element |
addXml(Element parent,
long flags)
Sets field elements, default attributes and all options to the specified Element object (XML tag). |
DataType |
getDataType()
Returns the data type. |
Object |
getDefaultValue()
Returns the default column value. |
Object |
getRecordDefaultValue(Connection conn)
Returns the default column value. |
String |
getSequenceName()
Gets the sequence name for this table's sequence (if it has one) This is derived form the default value or auto generated if no default value is set |
double |
getSize()
Gets the the column width. |
boolean |
isAutoGenerated()
Returns true if column is a numeric sequence or otherwise generated value |
boolean |
isReadOnly()
Checks whether the column is read only. |
boolean |
isRequired()
Returns true if column is mandatory. |
boolean |
isSingleByteChars()
Returns true if column the column is a single byte text or character column or false otherwise |
DBRelation.DBReference |
referenceOn(DBTableColumn target)
Creates a foreign key relation for this column. |
void |
setDefaultValue(Object defValue)
Sets the default column value. |
void |
setReadOnly(boolean readOnly)
Sets the read only attribute of the column. |
void |
setRequired(boolean required)
Changes the required property of the table column Use for dynamic data model changes only. |
void |
setSingleByteChars(boolean singleByteChars)
sets whether this column is a single byte character or text column |
void |
setSize(double size)
Changes the size of the table column Use for dynamic data model changes only. |
Object |
validate(Object value)
Checks whether the supplied value is valid for this column. |
protected void |
validateNumber(DataType type,
Number n)
|
Methods inherited from class org.apache.empire.db.DBColumn |
---|
addReferencedColumns, addSQL, checkValue, equals, findById, getAttribute, getComment, getDatabase, getFullName, getId, getName, getOptions, getRowSet, getUpdateColumn, hashCode, isAggregate, setComment, to, toString |
Methods inherited from class org.apache.empire.db.DBColumnExpr |
---|
abs, append, as, as, asc, avg, cmp, coalesce, convertTo, convertTo, count, countDistinct, day, decode, decode, decode, decode, decode, decode, desc, detectDataType, divideBy, getBeanPropertyName, getControlType, getExprFromPhrase, getExprFromPhrase, getSourceColumn, getTitle, in, indexOf, indexOf, indexOf, is, isBetween, isGreaterThan, isLessOrEqual, isMoreOrEqual, isNot, isNotBetween, isSmallerThan, length, like, like, likeLower, likeUpper, lower, max, min, minus, minus, month, multiplyWith, notIn, notLike, nvl, parenthesis, plus, plus, replace, reverse, round, setAttribute, setBeanPropertyName, setControlType, setOptions, setTitle, substring, substring, substring, substring, substring, substring, sum, toChar, toChar, trim, trimLeft, trimRight, trunc, upper, when, year |
Methods inherited from class org.apache.empire.db.DBExpr |
---|
getObjectValue, getValueClass |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.empire.data.ColumnExpr |
---|
getBeanPropertyName, getControlType, getSourceColumn, getTitle |
Field Detail |
---|
protected DataType type
protected double size
protected DataMode dataMode
protected Object defValue
Constructor Detail |
---|
public DBTableColumn(DBTable table, DataType type, String name, double size, DataMode dataMode, Object defValue)
table
- the table object to add the column to, set to null if you don't want it added to a tabletype
- the type of the column e.g. integer, text, datename
- the column namesize
- the column widthdataMode
- determines whether this column is optional, required or auto-generateddefValue
- the object valueprotected DBTableColumn(DBTable newTable, DBTableColumn other)
Method Detail |
---|
public Object getDefaultValue()
public void setDefaultValue(Object defValue)
defValue
- the default column valuepublic Object getRecordDefaultValue(Connection conn)
conn
- a valid database connection
public DataType getDataType()
getDataType
in interface ColumnExpr
getDataType
in class DBColumnExpr
DataType
public double getSize()
getSize
in interface Column
getSize
in class DBColumn
public void setSize(double size)
size
- the new column sizepublic boolean isRequired()
isRequired
in interface Column
isRequired
in class DBColumn
public boolean isAutoGenerated()
isAutoGenerated
in interface Column
isAutoGenerated
in class DBColumn
public boolean isSingleByteChars()
public void setSingleByteChars(boolean singleByteChars)
public void setRequired(boolean required)
required
- true if the column is required or false otherwisepublic boolean isReadOnly()
isReadOnly
in interface Column
isReadOnly
in class DBColumn
public void setReadOnly(boolean readOnly)
readOnly
- true if the column should be read only or false otherwisepublic Object validate(Object value)
validate
in interface Column
validate
in class DBColumn
value
- the checked to check for validity
protected void validateNumber(DataType type, Number n)
public DBRelation.DBReference referenceOn(DBTableColumn target)
target
- the referenced primary key column
public Element addXml(Element parent, long flags)
addXml
in class DBColumn
parent
- the parent objectflags
- a long value
public String getSequenceName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |