org.ujoframework.orm.metaModel
Class MetaColumn

java.lang.Object
  extended by org.ujoframework.extensions.AbstractUjo
      extended by org.ujoframework.implementation.quick.QuickUjo
          extended by org.ujoframework.orm.AbstractMetaModel
              extended by org.ujoframework.orm.metaModel.MetaRelation2Many
                  extended by org.ujoframework.orm.metaModel.MetaColumn
All Implemented Interfaces:
java.io.Serializable, UjoCloneable, UjoTextable, Ujo

public final class MetaColumn
extends MetaRelation2Many

Database column metadata

Author:
Pavel Ponec
See Also:
Serialized Form

Field Summary
static Property<MetaColumn,DbType> DB_TYPE
          Database Type
static Property<MetaColumn,java.lang.String> DEFAULT_VALUE
          DB Default value
static Property<MetaColumn,java.lang.String> INDEX
          A name of the non-unique database index for the column, where the same index can contain more columns.
static Property<MetaColumn,java.lang.Boolean> MANDATORY
          Column NOT-NULL
static Property<MetaColumn,java.lang.Integer> MAX_LENGTH
          Column value length
static Property<MetaColumn,java.lang.Integer> PRECISION
          Column value precision
static Property<MetaColumn,java.lang.Boolean> PRIMARY_KEY
          DB primary key
static Property<MetaColumn,java.lang.String> UNIQUE_INDEX
          A name of the unique database index for the column, where the same index can contain more columns.
 
Fields inherited from class org.ujoframework.orm.metaModel.MetaRelation2Many
ID, NAME, TABLE, TABLE_PROPERTY
 
Constructor Summary
MetaColumn()
           
MetaColumn(MetaTable table, UjoProperty tableProperty, MetaColumn param)
           
 
Method Summary
 java.lang.String getAliasName()
          Returns an ALIAS of table and COLUMN name.
 java.lang.Class getDialectClass()
          Returns a SQL dialect class from a related Database
 java.lang.String getForeignColumnName(int index)
          Returns a name of foreign column by index
 java.util.List<MetaColumn> getForeignColumns()
          Returns an original foreign columns in case a foreign column.
 MetaTable getForeignTable()
          Returns an original foreign columns in case a foreign column.
 java.lang.String getFullName()
          Returns a DB, TABLE and COLUMN name
 java.lang.Object getJdbcFriendlyDefaultValue()
          Returns a default value in a JDBC friendly type.
 int getMaxLength()
          Returns a maximal db column length in the database.
 int getPrecision()
          Returns the db column precision.
 java.lang.Class getType()
          Returns a Java Class of value
 char getTypeCode()
          A TypeCode
 java.lang.Object getValue(OrmUjo bo)
          Returns a property value from a table
 boolean hasDefaultValue()
          Has the property a default value (not null) ?
 void initTypeCode(MetaParams params)
          Initialize a type code - for an internal use only.
 boolean isColumn()
          It is a DB column (either a value of a foreign key), not a relation to many.
 boolean isForeignKey()
          Is it a Foreign Key ?
 boolean isMandatory()
          Returns true if the related db column is NOT NULL.
 boolean isPrimaryKey()
          Is it a Primary Key?
 boolean isVoid()
          Is the related property type void?
 void printForeignColumnFullName(int index, java.lang.Appendable out)
          Print a full 'alias' name of foreign column by index
 void setValue(Ujo bo, java.lang.Object value)
          Returns a property value from a table
 java.lang.String toString()
          Returns a TABLE and COLUMN names.
 
Methods inherited from class org.ujoframework.orm.metaModel.MetaRelation2Many
getHandler, getProperty, getTable, getTableClass, getValue
 
Methods inherited from class org.ujoframework.orm.AbstractMetaModel
get, changeDefault, checkReadOnly, isUsable, isUsable, readAuthorization, readOnly, setReadOnly, writeValue
 
Methods inherited from class org.ujoframework.implementation.quick.QuickUjo
newListProperty, newListProperty, newProperty, newProperty, newProperty, newProperty, newProperty, newProperty, readValue
 
Methods inherited from class org.ujoframework.extensions.AbstractUjo
clone, equals, init, init, readProperties, readUjoManager, readValueString, writeValueString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PRIMARY_KEY

public static final Property<MetaColumn,java.lang.Boolean> PRIMARY_KEY
DB primary key


DB_TYPE

public static final Property<MetaColumn,DbType> DB_TYPE
Database Type


MANDATORY

public static final Property<MetaColumn,java.lang.Boolean> MANDATORY
Column NOT-NULL


MAX_LENGTH

public static final Property<MetaColumn,java.lang.Integer> MAX_LENGTH
Column value length


PRECISION

public static final Property<MetaColumn,java.lang.Integer> PRECISION
Column value precision


DEFAULT_VALUE

public static final Property<MetaColumn,java.lang.String> DEFAULT_VALUE
DB Default value


INDEX

public static final Property<MetaColumn,java.lang.String> INDEX
A name of the non-unique database index for the column, where the same index can contain more columns. If a single column of the index is marked as unique, so the entire index will be unique.


UNIQUE_INDEX

public static final Property<MetaColumn,java.lang.String> UNIQUE_INDEX
A name of the unique database index for the column, where the same index can contain more columns. If a single column of the index is marked as unique, so the entire index will be unique.

Constructor Detail

MetaColumn

public MetaColumn()

MetaColumn

public MetaColumn(MetaTable table,
                  UjoProperty tableProperty,
                  MetaColumn param)
Method Detail

isColumn

public boolean isColumn()
It is a DB column (either a value of a foreign key), not a relation to many.

Overrides:
isColumn in class MetaRelation2Many

isForeignKey

public boolean isForeignKey()
Is it a Foreign Key ?

Overrides:
isForeignKey in class MetaRelation2Many

isPrimaryKey

public boolean isPrimaryKey()
Is it a Primary Key?


getMaxLength

public int getMaxLength()
Returns a maximal db column length in the database.

Returns:
If property is undefined then the method returns value -1.

getPrecision

public int getPrecision()
Returns the db column precision.

Returns:
If property is undefined then the method returns value -1.

isMandatory

public boolean isMandatory()
Returns true if the related db column is NOT NULL.


getForeignTable

public MetaTable getForeignTable()
Returns an original foreign columns in case a foreign column.


getForeignColumns

public java.util.List<MetaColumn> getForeignColumns()
Returns an original foreign columns in case a foreign column.


getForeignColumnName

public java.lang.String getForeignColumnName(int index)
Returns a name of foreign column by index


getValue

public java.lang.Object getValue(OrmUjo bo)
Returns a property value from a table


setValue

public void setValue(Ujo bo,
                     java.lang.Object value)
Returns a property value from a table


getType

public java.lang.Class getType()
Returns a Java Class of value


toString

public java.lang.String toString()
Returns a TABLE and COLUMN names.

Overrides:
toString in class MetaRelation2Many

getFullName

public java.lang.String getFullName()
Returns a DB, TABLE and COLUMN name


getAliasName

public java.lang.String getAliasName()
Returns an ALIAS of table and COLUMN name.


printForeignColumnFullName

public void printForeignColumnFullName(int index,
                                       java.lang.Appendable out)
                                throws java.io.IOException
Print a full 'alias' name of foreign column by index

Throws:
java.io.IOException

getTypeCode

public char getTypeCode()
A TypeCode

See Also:
TypeService

hasDefaultValue

public boolean hasDefaultValue()
Has the property a default value (not null) ? If the default value is an empty String than method returns false.


getJdbcFriendlyDefaultValue

public java.lang.Object getJdbcFriendlyDefaultValue()
Returns a default value in a JDBC friendly type. The real result type depends in an implementatin a TypeService. For example a Java Enumerator default value can return either the Integer or String type too.

See Also:
TypeService

getDialectClass

public java.lang.Class getDialectClass()
Returns a SQL dialect class from a related Database


initTypeCode

public void initTypeCode(MetaParams params)
Initialize a type code - for an internal use only.


isVoid

public boolean isVoid()
Is the related property type void?



Copyright © 2010. All Rights Reserved.