public class DatabaseField extends Object implements Cloneable, Serializable
Purpose: Define a fully qualified field name.
Responsibilities:
DatabaseTable
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected String |
columnDefinition |
protected int |
index
Store normal index of field in result set to optimize performance.
|
protected boolean |
isInsertable |
protected boolean |
isNullable |
protected boolean |
isUnique |
protected boolean |
isUpdatable |
protected int |
length |
protected String |
name
Column name of the field.
|
protected int |
precision |
protected int |
scale
Variables used for generating DDL
|
int |
sqlType
Respective JDBC type of the field's value.
|
protected DatabaseTable |
table
Fields table (encapsulates name + creator).
|
Class |
type
Respective Java type desired for the field's value, used to optimize performance and for binding.
|
Constructor and Description |
---|
DatabaseField() |
DatabaseField(String qualifiedName) |
DatabaseField(String fieldName,
DatabaseTable databaseTable) |
DatabaseField(String fieldName,
String tableName) |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
The table is not cloned because it is treated as an automic value.
|
boolean |
equals(DatabaseField field)
Determine whether the receiver is equal to a DatabaseField.
|
boolean |
equals(Object object)
Determine whether the receiver is equal to a DatabaseField.
|
String |
getColumnDefinition()
Get the SQL fragment that is used when generating the DDL for the column.
|
int |
getIndex()
Return the expected index that this field will occur in the result set
row.
|
int |
getLength()
Used to specify the column length when generating DDL.
|
String |
getName()
Return the unqualified name of the field.
|
int |
getPrecision()
Returns the precision for a decimal column when generating DDL.
|
String |
getQualifiedName()
Return the qualified name of the field.
|
int |
getScale()
Returns the scale for a decimal column when generating DDL.
|
int |
getSqlType()
Return the JDBC type that coresponds to the field.
|
DatabaseTable |
getTable() |
String |
getTableName() |
Class |
getType() |
int |
hashCode()
Return the hashcode of the name, because it is fairly unqiue.
|
boolean |
hasTableName() |
void |
initDDLFields()
Inits the DDL generation fields.
|
boolean |
isInsertable()
Used to specify whether the column should be included in SQL UPDATE
statements.
|
boolean |
isNullable()
Used for generatating DDL.
|
boolean |
isReadOnly()
Returns true is this database field should be read only.
|
boolean |
isUnique()
Used for generatating DDL.
|
boolean |
isUpdatable()
Returns whether the column should be included in SQL INSERT
statements.
|
void |
resetQualifiedName(String qualifiedName)
Reset the field's name and table from the qualified name.
|
void |
setColumnDefinition(String columnDefinition)
Set the SQL fragment that is used when generating the DDL for the column.
|
void |
setIndex(int index)
Set the expected index that this field will occur in the result set row.
|
void |
setInsertable(boolean isInsertable)
Used to specify whether the column should be included in SQL UPDATE
statements.
|
void |
setLength(int length)
Used to specify the column length when generating DDL.
|
void |
setName(String name)
Set the unqualified name of the field.
|
void |
setNullable(boolean isNullable)
Used for generatating DDL.
|
void |
setPrecision(int precision)
Used to specify the precision for a decimal column when generating DDL.
|
void |
setScale(int scale)
Used to specify the scale for a decimal column when generating DDL.
|
void |
setSqlType(int sqlType)
Set the JDBC type that coresponds to the field.
|
void |
setTable(DatabaseTable table)
Set the table for the field.
|
void |
setTableName(String tableName)
Set the table name for this field.
|
void |
setType(Class type)
Set the Java class type that coresponds to the field.
|
void |
setUnique(boolean isUnique)
Used for generatating DDL.
|
void |
setUpdatable(boolean isUpdatable)
Used to specify whether the column should be included in SQL INSERT
statements.
|
String |
toString() |
protected int scale
protected int length
protected int precision
protected boolean isUnique
protected boolean isNullable
protected boolean isUpdatable
protected boolean isInsertable
protected String columnDefinition
protected String name
protected DatabaseTable table
public transient Class type
public int sqlType
protected int index
public DatabaseField()
public DatabaseField(String qualifiedName)
public DatabaseField(String fieldName, DatabaseTable databaseTable)
public void initDDLFields()
public Object clone()
public boolean equals(DatabaseField field)
public boolean equals(Object object)
public String getColumnDefinition()
public int getIndex()
public int getLength()
public String getName()
public int getPrecision()
public String getQualifiedName()
public int getScale()
public int getSqlType()
public DatabaseTable getTable()
public String getTableName()
public Class getType()
public int hashCode()
public boolean hasTableName()
public boolean isInsertable()
public boolean isNullable()
public boolean isUnique()
public boolean isReadOnly()
public boolean isUpdatable()
public void resetQualifiedName(String qualifiedName)
public void setColumnDefinition(String columnDefinition)
public void setIndex(int index)
public void setInsertable(boolean isInsertable)
public void setLength(int length)
public void setName(String name)
public void setNullable(boolean isNullable)
public void setPrecision(int precision)
public void setScale(int scale)
public void setSqlType(int sqlType)
public void setTable(DatabaseTable table)
public void setTableName(String tableName)
public void setType(Class type)
public void setUnique(boolean isUnique)
public void setUpdatable(boolean isUpdatable)
Copyright © 2022. All rights reserved.