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:
UjoCloneable, UjoTextable, Ujo

public class MetaColumn
extends MetaRelation2Many

Database column metadata

Author:
Pavel Ponec

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_NAME
          The column is included in the index of the name (parameter is not implemented yet)
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
 
Fields inherited from class org.ujoframework.orm.metaModel.MetaRelation2Many
ID, NAME, TABLE, TABLE_PROPERTY
 
Fields inherited from class org.ujoframework.implementation.quick.QuickUjo
data
 
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.
 java.lang.String getFullName()
          Returns a DB, TABLE and COLUMN name
 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
 void initTypeCode()
          Initialize a type code - for an internal use only.
 boolean isColumn()
          It is a DB column (either a value of a foreign key)
 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?
 void printForeignColumnFullName(int index, java.lang.Appendable out)
          Print a full 'alias' name of foreign column by index
 void setValue(OrmUjo 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, getValue
 
Methods inherited from class org.ujoframework.orm.AbstractMetaModel
get, changeDefault, isUsable, isUsable, readAuthorization, readOnly, setReadOnly, testReadOnly, writeValue
 
Methods inherited from class org.ujoframework.implementation.quick.QuickUjo
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_NAME

public static final Property<MetaColumn,java.lang.String> INDEX_NAME
The column is included in the index of the name (parameter is not implemented yet)

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)

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.


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(OrmUjo 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:
TypeBook

getDialectClass

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


initTypeCode

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



Copyright © 2009. All Rights Reserved.