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 Spring or direct Java wiring or from a DatabaseField annotation.

Author:
graywatson

Constructor Summary
DatabaseFieldConfig()
           
DatabaseFieldConfig(String fieldName, String columnName, JdbcType jdbcType, String defaultValue, int width, boolean canBeNull, boolean id, boolean generatedId, String generatedIdSequence, boolean foreign, DatabaseTableConfig<?> foreignTableConfig, boolean useGetSet, Enum<?> unknownEnumValue, boolean throwIfNull)
           
 
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, 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()
           
 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 getGeneratedIdSequence()
           
 JdbcType getJdbcType()
           
 Enum<?> getUnknownEnumvalue()
           
 int getWidth()
           
 boolean isCanBeNull()
           
 boolean isForeign()
           
 boolean isGeneratedId()
           
 boolean isId()
           
 boolean isThrowIfNull()
           
 boolean isUseGetSet()
           
 void setCanBeNull(boolean canBeNull)
           
 void setColumnName(String columnName)
           
 void setDefaultValue(String defaultValue)
           
 void setFieldName(String fieldName)
           
 void setForeign(boolean foreign)
           
 void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig)
           
 void setGeneratedId(boolean generatedId)
           
 void setGeneratedIdSequence(String generatedIdSequence)
           
 void setId(boolean id)
           
 void setJdbcType(JdbcType jdbcType)
           
 void setThrowIfNull(boolean throwIfNull)
           
 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,
                           String columnName,
                           JdbcType jdbcType,
                           String defaultValue,
                           int width,
                           boolean canBeNull,
                           boolean id,
                           boolean generatedId,
                           String generatedIdSequence,
                           boolean foreign,
                           DatabaseTableConfig<?> foreignTableConfig,
                           boolean useGetSet,
                           Enum<?> unknownEnumValue,
                           boolean throwIfNull)
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)

getJdbcType

public JdbcType getJdbcType()
See Also:
DatabaseField.jdbcType()

setJdbcType

public void setJdbcType(JdbcType jdbcType)

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)

fromField

public static DatabaseFieldConfig fromField(DatabaseType databaseType,
                                            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 © 2010. All Rights Reserved.