-
Field Summary
Fields
protected int
protected boolean
Defines whether this column value is generated by the database.
protected boolean
Defines whether the attribute allows nulls.
protected int
protected boolean
Defines whether the attribute is a part of the table primary key.
protected int
protected int
Defines JDBC type of the column.
-
Constructor Summary
Constructors
-
Method Summary
<T> T
void
Prints itself as XML to the provided XMLEncoder.
int
Returns parent entity that holds this attribute.
int
Returns the length of database column described by this attribute.
int
Returns the number of digits after period for decimal attributes.
int
Returns the SQL type of the column.
boolean
Returns true
if the DB column represented by this attribute
is a foreign key, referencing another table.
boolean
Returns true if this column value is generated by the database.
boolean
boolean
void
void
Updates attribute "generated" property.
void
void
Sets the length of character or binary type or max num of digits for
DECIMAL.
void
Updates attribute "primaryKey" property.
void
void
Sets the SQL type for the column.
-
Field Details
-
type
protected int type
Defines JDBC type of the column.
-
mandatory
protected boolean mandatory
Defines whether the attribute allows nulls.
-
primaryKey
protected boolean primaryKey
Defines whether the attribute is a part of the table primary key.
-
generated
protected boolean generated
Defines whether this column value is generated by the database. Other
terms for such columns are "auto-increment" or "identity".
- Since:
- 1.2
-
maxLength
protected int maxLength
-
scale
protected int scale
- Since:
- 3.0
-
attributePrecision
protected int attributePrecision
- Since:
- 3.0
-
Constructor Details
-
DbAttribute
public DbAttribute()
-
DbAttribute
public DbAttribute(String name)
-
-
Method Details
-
getEntity
Returns parent entity that holds this attribute.
- Overrides:
getEntity
in class Attribute
-
-
-
-
getType
public int getType()
Returns the SQL type of the column.
- See Also:
-
-
setType
public void setType(int type)
Sets the SQL type for the column.
- See Also:
-
-
isPrimaryKey
public boolean isPrimaryKey()
-
isForeignKey
public boolean isForeignKey()
Returns true
if the DB column represented by this attribute
is a foreign key, referencing another table.
- Since:
- 1.1
-
setPrimaryKey
public void setPrimaryKey(boolean primaryKey)
Updates attribute "primaryKey" property.
-
isMandatory
public boolean isMandatory()
-
setMandatory
public void setMandatory(boolean mandatory)
-
getMaxLength
public int getMaxLength()
Returns the length of database column described by this attribute.
-
setMaxLength
public void setMaxLength(int maxLength)
Sets the length of character or binary type or max num of digits for
DECIMAL.
-
isGenerated
public boolean isGenerated()
Returns true if this column value is generated by the database. Other
terms for such columns are "auto-increment" or "identity".
- Since:
- 1.2
-
setGenerated
public void setGenerated(boolean generated)
Updates attribute "generated" property.
- Since:
- 1.2
-
getAttributePrecision
public int getAttributePrecision()
- Since:
- 3.0
-
setAttributePrecision
public void setAttributePrecision(int attributePrecision)
- Since:
- 3.0
-
getScale
public int getScale()
Returns the number of digits after period for decimal attributes. Returns
"-1" if not set.
- Since:
- 3.0
-
setScale
public void setScale(int scale)
- Since:
- 3.0
-