|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.map.Attribute
org.apache.cayenne.map.DbAttribute
public class DbAttribute
A DbAttribute defines a descriptor for a single database table column.
Field Summary | |
---|---|
protected int |
attributePrecision
|
protected boolean |
generated
Defines whether this column value is generated by the database. |
protected boolean |
mandatory
Defines whether the attribute allows nulls. |
protected int |
maxLength
|
protected boolean |
primaryKey
Defines whether the attribute is a part of the table primary key. |
protected int |
scale
|
protected int |
type
Defines JDBC type of the column. |
Fields inherited from class org.apache.cayenne.map.Attribute |
---|
entity, name |
Constructor Summary | |
---|---|
DbAttribute()
|
|
DbAttribute(String name)
|
|
DbAttribute(String name,
int type,
DbEntity entity)
|
Method Summary | |
---|---|
void |
encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided XMLEncoder. |
String |
getAliasedName(String alias)
|
int |
getAttributePrecision()
|
int |
getMaxLength()
Returns the length of database column described by this attribute. |
int |
getPrecision()
Deprecated. since 3.0 as this property really referred to 'scale'. Use getScale() instead. |
int |
getScale()
Returns the number of digits after period for decimal attributes. |
int |
getType()
Returns the SQL type of the column. |
boolean |
isForeignKey()
Returns true if the DB column represented by this attribute is a
foreign key, referencing another table. |
boolean |
isGenerated()
Returns true if this column value is generated by the database. |
boolean |
isMandatory()
|
boolean |
isPrimaryKey()
|
void |
setAttributePrecision(int attributePrecision)
|
void |
setGenerated(boolean generated)
Updates attribute "generated" property. |
void |
setMandatory(boolean mandatory)
|
void |
setMaxLength(int maxLength)
Sets the length of character or binary type or max num of digits for DECIMAL. |
void |
setPrecision(int i)
Deprecated. since 3.0 as this property really referred to 'scale'. Use setScale(int) instead. |
void |
setPrimaryKey(boolean primaryKey)
Updates attribute "primaryKey" property. |
void |
setScale(int scale)
|
void |
setType(int type)
Sets the SQL type for the column. |
Methods inherited from class org.apache.cayenne.map.Attribute |
---|
getEntity, getName, getParent, setEntity, setName, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int type
protected boolean mandatory
protected boolean primaryKey
protected boolean generated
protected int maxLength
protected int scale
protected int attributePrecision
Constructor Detail |
---|
public DbAttribute()
public DbAttribute(String name)
public DbAttribute(String name, int type, DbEntity entity)
Method Detail |
---|
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
encodeAsXML
in class Attribute
public String getAliasedName(String alias)
public int getType()
Types
public void setType(int type)
Types
public boolean isPrimaryKey()
public boolean isForeignKey()
true
if the DB column represented by this attribute is a
foreign key, referencing another table.
public void setPrimaryKey(boolean primaryKey)
public boolean isMandatory()
public void setMandatory(boolean mandatory)
public int getMaxLength()
public void setMaxLength(int maxLength)
public int getPrecision()
getScale()
instead.
public void setPrecision(int i)
setScale(int)
instead.
public boolean isGenerated()
public void setGenerated(boolean generated)
public int getAttributePrecision()
public void setAttributePrecision(int attributePrecision)
public int getScale()
public void setScale(int scale)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |