com.j256.ormlite.field
Class DatabaseFieldConfig

java.lang.Object
  extended by com.j256.ormlite.field.DatabaseFieldConfig

public class DatabaseFieldConfig
extends Object

Database field configuration information either supplied by a DatabaseField annotation or by direct Java or Spring wiring.

Author:
graywatson

Constructor Summary
DatabaseFieldConfig()
           
DatabaseFieldConfig(String fieldName)
           
DatabaseFieldConfig(String fieldName, String columnName, DataType dataType, String defaultValue, int width, boolean canBeNull, boolean id, boolean generatedId, String generatedIdSequence, boolean foreign, DatabaseTableConfig<?> foreignTableConfig, boolean useGetSet, Enum<?> unknownEnumValue, boolean throwIfNull, String format, boolean unique, String indexName, String uniqueIndexName, boolean autoRefresh)
           
 
Method Summary
static Method findGetMethod(Field field, boolean throwExceptions)
          Find and return the appropriate getter method for field.
static Method findSetMethod(Field field, boolean throwExceptions)
          Find and return the appropriate setter method for field.
static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field)
          Create and return a config converted from a Field that may have either a DatabaseField annotation or the javax.persistence annotations.
 String getColumnName()
           
 DataType getDataType()
           
 String getDefaultValue()
           
 String getFieldName()
          Return the name of the field in the class.
 DatabaseTableConfig<?> getForeignTableConfig()
          For a foreign class which does not use the DatabaseField annotations, you need to inject the table configuration.
 String getFormat()
           
 String getGeneratedIdSequence()
           
 String getIndexName()
           
 String getUniqueIndexName()
           
 Enum<?> getUnknownEnumvalue()
           
 int getWidth()
           
 boolean isCanBeNull()
           
 boolean isForeign()
           
 boolean isForeignAutoRefresh()
           
 boolean isForeignCollection()
           
 boolean isForeignCollectionEager()
           
 boolean isGeneratedId()
           
 boolean isId()
           
 boolean isThrowIfNull()
           
 boolean isUnique()
           
 boolean isUniqueCombo()
           
 boolean isUseGetSet()
           
 void setCanBeNull(boolean canBeNull)
           
 void setColumnName(String columnName)
           
 void setDataType(DataType dataType)
           
 void setDefaultValue(String defaultValue)
           
 void setFieldName(String fieldName)
           
 void setForeign(boolean foreign)
           
 void setForeignAutoRefresh(boolean foreignAutoRefresh)
           
 void setForeignCollection(boolean foreignCollection)
           
 void setForeignCollectionEager(boolean foreignCollectionEager)
           
 void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig)
           
 void setFormat(String format)
           
 void setGeneratedId(boolean generatedId)
           
 void setGeneratedIdSequence(String generatedIdSequence)
           
 void setId(boolean id)
           
 void setIndexName(String indexName)
           
 void setThrowIfNull(boolean throwIfNull)
           
 void setUnique(boolean unique)
           
 void setUniqueIndexName(String uniqueIndexName)
           
 void setUnknownEnumvalue(Enum<?> unknownEnumvalue)
           
 void setUseGetSet(boolean useGetSet)
           
 void setWidth(int width)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseFieldConfig

public DatabaseFieldConfig()

DatabaseFieldConfig

public DatabaseFieldConfig(String fieldName)

DatabaseFieldConfig

public DatabaseFieldConfig(String fieldName,
                           String columnName,
                           DataType dataType,
                           String defaultValue,
                           int width,
                           boolean canBeNull,
                           boolean id,
                           boolean generatedId,
                           String generatedIdSequence,
                           boolean foreign,
                           DatabaseTableConfig<?> foreignTableConfig,
                           boolean useGetSet,
                           Enum<?> unknownEnumValue,
                           boolean throwIfNull,
                           String format,
                           boolean unique,
                           String indexName,
                           String uniqueIndexName,
                           boolean autoRefresh)
Method Detail

getFieldName

public String getFieldName()
Return the name of the field in the class.


setFieldName

public void setFieldName(String fieldName)

getColumnName

public String getColumnName()
See Also:
DatabaseField.columnName()

setColumnName

public void setColumnName(String columnName)

getDataType

public DataType getDataType()
See Also:
DatabaseField.dataType()

setDataType

public void setDataType(DataType dataType)

getDefaultValue

public String getDefaultValue()
See Also:
DatabaseField.defaultValue()

setDefaultValue

public void setDefaultValue(String defaultValue)

getWidth

public int getWidth()
See Also:
DatabaseField.width()

setWidth

public void setWidth(int width)

isCanBeNull

public boolean isCanBeNull()
See Also:
DatabaseField.canBeNull()

setCanBeNull

public void setCanBeNull(boolean canBeNull)

isId

public boolean isId()
See Also:
DatabaseField.id()

setId

public void setId(boolean id)

isGeneratedId

public boolean isGeneratedId()
See Also:
DatabaseField.generatedId()

setGeneratedId

public void setGeneratedId(boolean generatedId)

getGeneratedIdSequence

public String getGeneratedIdSequence()
See Also:
DatabaseField.generatedIdSequence()

setGeneratedIdSequence

public void setGeneratedIdSequence(String generatedIdSequence)

isForeign

public boolean isForeign()
See Also:
DatabaseField.foreign()

setForeign

public void setForeign(boolean foreign)

getForeignTableConfig

public DatabaseTableConfig<?> getForeignTableConfig()
For a foreign class which does not use the DatabaseField annotations, you need to inject the table configuration.


setForeignTableConfig

public void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig)

isUseGetSet

public boolean isUseGetSet()
See Also:
DatabaseField.useGetSet()

setUseGetSet

public void setUseGetSet(boolean useGetSet)

getUnknownEnumvalue

public Enum<?> getUnknownEnumvalue()

setUnknownEnumvalue

public void setUnknownEnumvalue(Enum<?> unknownEnumvalue)

isThrowIfNull

public boolean isThrowIfNull()

setThrowIfNull

public void setThrowIfNull(boolean throwIfNull)

getFormat

public String getFormat()

setFormat

public void setFormat(String format)

isUnique

public boolean isUnique()

setUnique

public void setUnique(boolean unique)

isUniqueCombo

public boolean isUniqueCombo()

getIndexName

public String getIndexName()

setIndexName

public void setIndexName(String indexName)

getUniqueIndexName

public String getUniqueIndexName()

setUniqueIndexName

public void setUniqueIndexName(String uniqueIndexName)

setForeignAutoRefresh

public void setForeignAutoRefresh(boolean foreignAutoRefresh)

isForeignAutoRefresh

public boolean isForeignAutoRefresh()

setForeignCollection

public void setForeignCollection(boolean foreignCollection)

isForeignCollection

public boolean isForeignCollection()

setForeignCollectionEager

public void setForeignCollectionEager(boolean foreignCollectionEager)

isForeignCollectionEager

public boolean isForeignCollectionEager()

fromField

public static DatabaseFieldConfig fromField(DatabaseType databaseType,
                                            String tableName,
                                            Field field)
                                     throws SQLException
Create and return a config converted from a Field that may have either a DatabaseField annotation or the javax.persistence annotations.

Throws:
SQLException

findGetMethod

public static Method findGetMethod(Field field,
                                   boolean throwExceptions)
Find and return the appropriate getter method for field.

Returns:
Get method or null if none found.

findSetMethod

public static Method findSetMethod(Field field,
                                   boolean throwExceptions)
Find and return the appropriate setter method for field.

Returns:
Set method or null if none found.


Copyright © 2011. All Rights Reserved.