public class DbAttribute extends Attribute implements ConfigurationNode
Modifier and Type | Field and Description |
---|---|
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.
|
Constructor and Description |
---|
DbAttribute() |
DbAttribute(String name) |
DbAttribute(String name,
int type,
DbEntity entity) |
Modifier and Type | Method and Description |
---|---|
<T> T |
acceptVisitor(ConfigurationNodeVisitor<T> visitor) |
void |
encodeAsXML(XMLEncoder encoder)
Prints itself as XML to the provided XMLEncoder.
|
String |
getAliasedName(String alias) |
int |
getAttributePrecision() |
DbEntity |
getEntity()
Returns parent entity that holds this attribute.
|
int |
getMaxLength()
Returns the length of database column described by this attribute.
|
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 |
setPrimaryKey(boolean primaryKey)
Updates attribute "primaryKey" property.
|
void |
setScale(int scale) |
void |
setType(int type)
Sets the SQL type for the column.
|
String |
toString() |
protected int type
protected boolean mandatory
protected boolean primaryKey
protected boolean generated
protected int maxLength
protected int scale
protected int attributePrecision
public DbAttribute()
public DbAttribute(String name)
public DbEntity getEntity()
Attribute
public <T> T acceptVisitor(ConfigurationNodeVisitor<T> visitor)
acceptVisitor
in interface ConfigurationNode
public void encodeAsXML(XMLEncoder encoder)
encodeAsXML
in interface XMLSerializable
encodeAsXML
in class Attribute
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 boolean isGenerated()
public void setGenerated(boolean generated)
public int getAttributePrecision()
public void setAttributePrecision(int attributePrecision)
public int getScale()
public void setScale(int scale)
Copyright © 2001–2023 Apache Cayenne. All rights reserved.