Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class ColumnDefinition
- Object
- ColumnDefinition
One persisted field of an entity: what it is called in Java, what it is called in the database, and what kind of value it holds.
Built by the generated code at class-initialization time and never changed, so one instance is shared by every request that touches the entity.
The SQL type is deliberately NOT here. It is the Dialect that turns a kind into a type name, because
the same entity has to declare TEXT on SQLite, TEXT on PostgreSQL and VARCHAR
on MySQL. getDeclaredType() is the escape hatch for the schema that
needs a specific one, and it carries the cost of naming an engine.
Constructors
public ColumnDefinition(String field, String column, int kind, boolean nullable, String declaredType, boolean id, boolean generated) |
Methods
public String getField() | The Java field name, which is how a query names it. |
public String getColumn() | The column name, from @Column(name) or the field name. |
public int getKind() | One of the kind constants on Dialect. |
public boolean isNullable() | Whether the column is declared without NOT NULL. |
public String getDeclaredType() | An explicit SQL type from @Column(type), or null to let the dialect name it. |
public boolean isId() | Whether this is the primary key. |
public boolean isGenerated() | Whether the DATABASE assigns this key rather than the application. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Constructor details
ColumnDefinition
public ColumnDefinition(String field, String column, int kind, boolean nullable, String declaredType, boolean id, boolean generated)Method details
getField
public String getField()The Java field name, which is how a query names it.
getColumn
public String getColumn()The column name, from @Column(name) or the field name.
getKind
public int getKind()One of the kind constants on
Dialect.isNullable
public boolean isNullable()Whether the column is declared without NOT NULL.
getDeclaredType
public String getDeclaredType()An explicit SQL type from @Column(type), or null to let the dialect name it.
isId
public boolean isId()Whether this is the primary key.
isGenerated
public boolean isGenerated()Whether the DATABASE assigns this key rather than the application.
toString
public String toString()Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + ‘@’ + Integer.toHexString(hashCode())