com.j256.ormlite.table
Class TableInfo<T,ID>

java.lang.Object
  extended by com.j256.ormlite.table.TableInfo<T,ID>
Type Parameters:
T - The class that the code will be operating on.
ID - The class of the ID column associated with the class. The T class does not require an ID field. The class needs an ID parameter however so you can use Void or Object to satisfy the compiler.

public class TableInfo<T,ID>
extends Object

Information about a database table including the associated tableName, class, constructor, and the included fields.

Author:
graywatson

Constructor Summary
TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T,ID> baseDaoImpl, Class<T> dataClass)
          Creates a holder of information about a table/class.
TableInfo(DatabaseType databaseType, BaseDaoImpl<T,ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig)
          Creates a holder of information about a table/class.
 
Method Summary
 T createObject()
          Create and return an object of this type using our reflection constructor.
 Constructor<T> getConstructor()
           
 Class<T> getDataClass()
          Return the class associated with this object-info.
 FieldType getFieldTypeByColumnName(String columnName)
          Return the FieldType associated with the columnName.
 FieldType[] getFieldTypes()
          Return the array of field types associated with the object.
 FieldType[] getForeignCollections()
          Return an array with the fields that are ForeignCollections or a blank array if none.
 FieldType getIdField()
          Return the id-field associated with the object.
 String getTableName()
          Return the name of the table associated with the object.
 boolean hasColumnName(String columnName)
          Return true if this table information has a field with this columnName as set by DatabaseField.columnName() or the field name if not set.
 boolean isForeignAutoCreate()
          Return true if one of the fields has DatabaseField.foreignAutoCreate() enabled.
 boolean isUpdatable()
          Return true if we can update this object via its ID.
 String objectToString(T object)
          Return a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableInfo

public TableInfo(ConnectionSource connectionSource,
                 BaseDaoImpl<T,ID> baseDaoImpl,
                 Class<T> dataClass)
          throws SQLException
Creates a holder of information about a table/class.

Parameters:
connectionSource - Source of our database connections.
baseDaoImpl - Associated BaseDaoImpl.
dataClass - Class that we are holding information about.
Throws:
SQLException

TableInfo

public TableInfo(DatabaseType databaseType,
                 BaseDaoImpl<T,ID> baseDaoImpl,
                 DatabaseTableConfig<T> tableConfig)
          throws SQLException
Creates a holder of information about a table/class.

Parameters:
databaseType - Database type we are storing the class in.
baseDaoImpl - Associated BaseDaoImpl.
tableConfig - Configuration for our table.
Throws:
SQLException
Method Detail

getDataClass

public Class<T> getDataClass()
Return the class associated with this object-info.


getTableName

public String getTableName()
Return the name of the table associated with the object.


getFieldTypes

public FieldType[] getFieldTypes()
Return the array of field types associated with the object.


getFieldTypeByColumnName

public FieldType getFieldTypeByColumnName(String columnName)
Return the FieldType associated with the columnName.


getIdField

public FieldType getIdField()
Return the id-field associated with the object.


getConstructor

public Constructor<T> getConstructor()

objectToString

public String objectToString(T object)
Return a string representation of the object.


createObject

public T createObject()
               throws SQLException
Create and return an object of this type using our reflection constructor.

Throws:
SQLException

isUpdatable

public boolean isUpdatable()
Return true if we can update this object via its ID.


isForeignAutoCreate

public boolean isForeignAutoCreate()
Return true if one of the fields has DatabaseField.foreignAutoCreate() enabled.


getForeignCollections

public FieldType[] getForeignCollections()
Return an array with the fields that are ForeignCollections or a blank array if none.


hasColumnName

public boolean hasColumnName(String columnName)
Return true if this table information has a field with this columnName as set by DatabaseField.columnName() or the field name if not set.



This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.