public class DatabaseFieldConfig extends Object
DatabaseField
annotation or by direct Java or
Spring wiring.Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_CAN_BE_NULL |
static DataType |
DEFAULT_DATA_TYPE |
static boolean |
DEFAULT_FOREIGN_COLLECTION_ORDER_ASCENDING |
static int |
DEFAULT_MAX_EAGER_FOREIGN_COLLECTION_LEVEL |
static boolean |
DEFAULT_PERSISTED |
static Class<? extends DataPersister> |
DEFAULT_PERSISTER_CLASS |
static int |
NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED |
Constructor and Description |
---|
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,
int maxForeignAutoRefreshLevel,
int maxForeignCollectionLevel) |
Modifier and Type | Method and Description |
---|---|
static Method |
findGetMethod(Field field,
DatabaseType databaseType,
boolean throwExceptions)
Find and return the appropriate getter method for field.
|
static Enum<?> |
findMatchingEnumVal(Field field,
String unknownEnumName)
Internal method that finds the matching enum for a configured field that has the name argument.
|
static Method |
findSetMethod(Field field,
DatabaseType databaseType,
boolean throwExceptions)
Find and return the appropriate setter method for field.
|
static DatabaseFieldConfig |
fromDatabaseField(DatabaseType databaseType,
String tableName,
Field field,
DatabaseField databaseField) |
static DatabaseFieldConfig |
fromField(DatabaseType databaseType,
String tableName,
Field field)
Create and return a config converted from a
Field that may have one of the following annotations:
DatabaseField , ForeignCollectionField , or javax.persistence... |
String |
getColumnDefinition() |
String |
getColumnName() |
DataPersister |
getDataPersister() |
DataType |
getDataType() |
String |
getDefaultValue() |
String |
getFieldName()
Return the name of the field in the class.
|
String |
getForeignCollectionColumnName() |
String |
getForeignCollectionForeignFieldName() |
int |
getForeignCollectionMaxEagerLevel() |
String |
getForeignCollectionOrderColumnName() |
String |
getForeignColumnName() |
DatabaseTableConfig<?> |
getForeignTableConfig()
For a foreign class which does not use the
DatabaseField annotations, you need to inject the table
configuration. |
String |
getFormat() |
String |
getFullColumnDefinition() |
String |
getGeneratedIdSequence() |
String |
getIndexName(String tableName) |
int |
getMaxForeignAutoRefreshLevel() |
Class<? extends DataPersister> |
getPersisterClass() |
String |
getUniqueIndexName(String tableName) |
Enum<?> |
getUnknownEnumValue() |
int |
getWidth() |
boolean |
isAllowGeneratedIdInsert() |
boolean |
isCanBeNull() |
boolean |
isForeign() |
boolean |
isForeignAutoCreate() |
boolean |
isForeignAutoRefresh() |
boolean |
isForeignCollection() |
boolean |
isForeignCollectionEager() |
boolean |
isForeignCollectionOrderAscending() |
boolean |
isGeneratedId() |
boolean |
isId() |
boolean |
isIndex() |
boolean |
isJavaxEntity() |
boolean |
isPersisted() |
boolean |
isReadOnly() |
boolean |
isThrowIfNull() |
boolean |
isUnique() |
boolean |
isUniqueCombo() |
boolean |
isUniqueIndex() |
boolean |
isUseGetSet() |
boolean |
isVersion() |
void |
postProcess()
Process the settings when we are going to consume them.
|
void |
setAllowGeneratedIdInsert(boolean allowGeneratedIdInsert) |
void |
setCanBeNull(boolean canBeNull) |
void |
setColumnDefinition(String columnDefinition) |
void |
setColumnName(String columnName) |
void |
setDataPersister(DataPersister dataPersister)
The name is historical.
|
void |
setDataType(DataType dataType) |
void |
setDefaultValue(String defaultValue) |
void |
setFieldName(String fieldName) |
void |
setForeign(boolean foreign) |
void |
setForeignAutoCreate(boolean foreignAutoCreate) |
void |
setForeignAutoRefresh(boolean foreignAutoRefresh) |
void |
setForeignCollection(boolean foreignCollection) |
void |
setForeignCollectionColumnName(String foreignCollectionColumn) |
void |
setForeignCollectionEager(boolean foreignCollectionEager) |
void |
setForeignCollectionForeignFieldName(String foreignCollectionForeignFieldName) |
void |
setForeignCollectionMaxEagerLevel(int foreignCollectionMaxEagerLevel) |
void |
setForeignCollectionOrderAscending(boolean foreignCollectionOrderAscending) |
void |
setForeignCollectionOrderColumnName(String foreignCollectionOrderColumn) |
void |
setForeignColumnName(String foreignColumnName) |
void |
setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig) |
void |
setFormat(String format) |
void |
setFullColumnDefinition(String fullColumnDefinition) |
void |
setGeneratedId(boolean generatedId) |
void |
setGeneratedIdSequence(String generatedIdSequence) |
void |
setId(boolean id) |
void |
setIndex(boolean index) |
void |
setIndexName(String indexName) |
void |
setJavaxEntity(boolean javaxEntity) |
void |
setMaxForeignAutoRefreshLevel(int maxForeignLevel) |
void |
setPersisted(boolean persisted) |
void |
setPersisterClass(Class<? extends DataPersister> persisterClass) |
void |
setReadOnly(boolean readOnly) |
void |
setThrowIfNull(boolean throwIfNull) |
void |
setUnique(boolean unique) |
void |
setUniqueCombo(boolean uniqueCombo) |
void |
setUniqueIndex(boolean uniqueIndex) |
void |
setUniqueIndexName(String uniqueIndexName) |
void |
setUnknownEnumValue(Enum<?> unknownEnumValue) |
void |
setUseGetSet(boolean useGetSet) |
void |
setVersion(boolean version) |
void |
setWidth(int width) |
public static final Class<? extends DataPersister> DEFAULT_PERSISTER_CLASS
public static final DataType DEFAULT_DATA_TYPE
public static final boolean DEFAULT_CAN_BE_NULL
public static final boolean DEFAULT_FOREIGN_COLLECTION_ORDER_ASCENDING
public static final boolean DEFAULT_PERSISTED
public static final int NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED
public static final int DEFAULT_MAX_EAGER_FOREIGN_COLLECTION_LEVEL
public DatabaseFieldConfig()
public DatabaseFieldConfig(String fieldName)
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, int maxForeignAutoRefreshLevel, int maxForeignCollectionLevel)
public String getFieldName()
public void setFieldName(String fieldName)
public String getColumnName()
DatabaseField.columnName()
public void setColumnName(String columnName)
public DataType getDataType()
DatabaseField.dataType()
public void setDataType(DataType dataType)
public DataPersister getDataPersister()
public void setDataPersister(DataPersister dataPersister)
public String getDefaultValue()
DatabaseField.defaultValue()
public void setDefaultValue(String defaultValue)
public int getWidth()
DatabaseField.width()
public void setWidth(int width)
public boolean isCanBeNull()
DatabaseField.canBeNull()
public void setCanBeNull(boolean canBeNull)
public boolean isId()
DatabaseField.id()
public void setId(boolean id)
public boolean isGeneratedId()
DatabaseField.generatedId()
public void setGeneratedId(boolean generatedId)
public String getGeneratedIdSequence()
DatabaseField.generatedIdSequence()
public void setGeneratedIdSequence(String generatedIdSequence)
public boolean isForeign()
DatabaseField.foreign()
public void setForeign(boolean foreign)
public DatabaseTableConfig<?> getForeignTableConfig()
DatabaseField
annotations, you need to inject the table
configuration.public void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig)
public boolean isUseGetSet()
DatabaseField.useGetSet()
public void setUseGetSet(boolean useGetSet)
public Enum<?> getUnknownEnumValue()
public void setUnknownEnumValue(Enum<?> unknownEnumValue)
public boolean isThrowIfNull()
public void setThrowIfNull(boolean throwIfNull)
public boolean isPersisted()
public void setPersisted(boolean persisted)
public String getFormat()
public void setFormat(String format)
public boolean isUnique()
public void setUnique(boolean unique)
public boolean isUniqueCombo()
public void setUniqueCombo(boolean uniqueCombo)
public boolean isIndex()
public void setIndex(boolean index)
public void setIndexName(String indexName)
public boolean isUniqueIndex()
public void setUniqueIndex(boolean uniqueIndex)
public void setUniqueIndexName(String uniqueIndexName)
public void setForeignAutoRefresh(boolean foreignAutoRefresh)
public boolean isForeignAutoRefresh()
public int getMaxForeignAutoRefreshLevel()
public void setMaxForeignAutoRefreshLevel(int maxForeignLevel)
public boolean isForeignCollection()
public void setForeignCollection(boolean foreignCollection)
public boolean isForeignCollectionEager()
public void setForeignCollectionEager(boolean foreignCollectionEager)
public int getForeignCollectionMaxEagerLevel()
public void setForeignCollectionMaxEagerLevel(int foreignCollectionMaxEagerLevel)
public String getForeignCollectionColumnName()
public void setForeignCollectionColumnName(String foreignCollectionColumn)
public String getForeignCollectionOrderColumnName()
public void setForeignCollectionOrderColumnName(String foreignCollectionOrderColumn)
public boolean isForeignCollectionOrderAscending()
public void setForeignCollectionOrderAscending(boolean foreignCollectionOrderAscending)
public String getForeignCollectionForeignFieldName()
public void setForeignCollectionForeignFieldName(String foreignCollectionForeignFieldName)
public Class<? extends DataPersister> getPersisterClass()
public void setPersisterClass(Class<? extends DataPersister> persisterClass)
public boolean isAllowGeneratedIdInsert()
public void setAllowGeneratedIdInsert(boolean allowGeneratedIdInsert)
public String getColumnDefinition()
public void setColumnDefinition(String columnDefinition)
public String getFullColumnDefinition()
public void setFullColumnDefinition(String fullColumnDefinition)
public boolean isForeignAutoCreate()
public void setForeignAutoCreate(boolean foreignAutoCreate)
public boolean isVersion()
public void setVersion(boolean version)
public String getForeignColumnName()
public void setForeignColumnName(String foreignColumnName)
public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
public boolean isJavaxEntity()
public void setJavaxEntity(boolean javaxEntity)
public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException
Field
that may have one of the following annotations:
DatabaseField
, ForeignCollectionField
, or javax.persistence...SQLException
public static Method findGetMethod(Field field, DatabaseType databaseType, boolean throwExceptions) throws IllegalArgumentException
IllegalArgumentException
public static Method findSetMethod(Field field, DatabaseType databaseType, boolean throwExceptions) throws IllegalArgumentException
IllegalArgumentException
public static DatabaseFieldConfig fromDatabaseField(DatabaseType databaseType, String tableName, Field field, DatabaseField databaseField)
public void postProcess()
public static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName)
IllegalArgumentException
- If the enum name is not known.This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.