Class ColumnDefinition
java.lang.Object
com.codename1.backend.orm.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.
-
Constructor Summary
ConstructorsConstructorDescriptionColumnDefinition(String field, String column, int kind, boolean nullable, String declaredType, boolean id, boolean generated) -
Method Summary
Modifier and TypeMethodDescriptionThe column name, from @Column(name) or the field name.An explicit SQL type from @Column(type), or null to let the dialect name it.getField()The Java field name, which is how a query names it.intgetKind()One of the kind constants onDialect.booleanWhether the DATABASE assigns this key rather than the application.booleanisId()Whether this is the primary key.booleanWhether the column is declared without NOT NULL.toString()Returns a string representation of the object.
-
Constructor Details
-
ColumnDefinition
-
-
Method Details
-
getField
The Java field name, which is how a query names it. -
getColumn
The column name, from @Column(name) or the field name. -
getKind
public int getKind()One of the kind constants onDialect. -
isNullable
public boolean isNullable()Whether the column is declared without NOT NULL. -
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
Description copied from class:ObjectReturns 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())
-