@Test(expected = IllegalArgumentException.class) public void testUnknownEnumVal() throws Exception { Field[] fields = BadUnknownVal.class.getDeclaredFields(); assertTrue(fields.length >= 1); DatabaseFieldConfig.fromField(databaseType, "foo", fields[0]); }
public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } }
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } }
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } 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); }
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } 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); String getFieldName(); void setFieldName(String fieldName); String getColumnName(); void setColumnName(String columnName); DataType getDataType(); void setDataType(DataType dataType); DataPersister getDataPersister(); void setDataPersister(DataPersister dataPersister); String getDefaultValue(); void setDefaultValue(String defaultValue); int getWidth(); void setWidth(int width); boolean isCanBeNull(); void setCanBeNull(boolean canBeNull); boolean isId(); void setId(boolean id); boolean isGeneratedId(); void setGeneratedId(boolean generatedId); String getGeneratedIdSequence(); void setGeneratedIdSequence(String generatedIdSequence); boolean isForeign(); void setForeign(boolean foreign); DatabaseTableConfig<?> getForeignTableConfig(); void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig); boolean isUseGetSet(); void setUseGetSet(boolean useGetSet); Enum<?> getUnknownEnumValue(); void setUnknownEnumValue(Enum<?> unknownEnumValue); boolean isThrowIfNull(); void setThrowIfNull(boolean throwIfNull); boolean isPersisted(); void setPersisted(boolean persisted); String getFormat(); void setFormat(String format); boolean isUnique(); void setUnique(boolean unique); boolean isUniqueCombo(); void setUniqueCombo(boolean uniqueCombo); boolean isIndex(); void setIndex(boolean index); String getIndexName(String tableName); void setIndexName(String indexName); boolean isUniqueIndex(); void setUniqueIndex(boolean uniqueIndex); String getUniqueIndexName(String tableName); void setUniqueIndexName(String uniqueIndexName); void setForeignAutoRefresh(boolean foreignAutoRefresh); boolean isForeignAutoRefresh(); int getMaxForeignAutoRefreshLevel(); void setMaxForeignAutoRefreshLevel(int maxForeignLevel); boolean isForeignCollection(); void setForeignCollection(boolean foreignCollection); boolean isForeignCollectionEager(); void setForeignCollectionEager(boolean foreignCollectionEager); int getForeignCollectionMaxEagerLevel(); void setForeignCollectionMaxEagerLevel(int foreignCollectionMaxEagerLevel); String getForeignCollectionColumnName(); void setForeignCollectionColumnName(String foreignCollectionColumn); String getForeignCollectionOrderColumnName(); void setForeignCollectionOrderColumnName(String foreignCollectionOrderColumn); boolean isForeignCollectionOrderAscending(); void setForeignCollectionOrderAscending(boolean foreignCollectionOrderAscending); String getForeignCollectionForeignFieldName(); void setForeignCollectionForeignFieldName(String foreignCollectionForeignFieldName); Class<? extends DataPersister> getPersisterClass(); void setPersisterClass(Class<? extends DataPersister> persisterClass); boolean isAllowGeneratedIdInsert(); void setAllowGeneratedIdInsert(boolean allowGeneratedIdInsert); String getColumnDefinition(); void setColumnDefinition(String columnDefinition); boolean isForeignAutoCreate(); void setForeignAutoCreate(boolean foreignAutoCreate); boolean isVersion(); void setVersion(boolean version); String getForeignColumnName(); void setForeignColumnName(String foreignColumnName); boolean isReadOnly(); void setReadOnly(boolean readOnly); static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field); static Method findGetMethod(Field field, boolean throwExceptions); static Method findSetMethod(Field field, boolean throwExceptions); static DatabaseFieldConfig fromDatabaseField(DatabaseType databaseType, String tableName, Field field,
			DatabaseField databaseField); void postProcess(); static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName); }
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } 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); String getFieldName(); void setFieldName(String fieldName); String getColumnName(); void setColumnName(String columnName); DataType getDataType(); void setDataType(DataType dataType); DataPersister getDataPersister(); void setDataPersister(DataPersister dataPersister); String getDefaultValue(); void setDefaultValue(String defaultValue); int getWidth(); void setWidth(int width); boolean isCanBeNull(); void setCanBeNull(boolean canBeNull); boolean isId(); void setId(boolean id); boolean isGeneratedId(); void setGeneratedId(boolean generatedId); String getGeneratedIdSequence(); void setGeneratedIdSequence(String generatedIdSequence); boolean isForeign(); void setForeign(boolean foreign); DatabaseTableConfig<?> getForeignTableConfig(); void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig); boolean isUseGetSet(); void setUseGetSet(boolean useGetSet); Enum<?> getUnknownEnumValue(); void setUnknownEnumValue(Enum<?> unknownEnumValue); boolean isThrowIfNull(); void setThrowIfNull(boolean throwIfNull); boolean isPersisted(); void setPersisted(boolean persisted); String getFormat(); void setFormat(String format); boolean isUnique(); void setUnique(boolean unique); boolean isUniqueCombo(); void setUniqueCombo(boolean uniqueCombo); boolean isIndex(); void setIndex(boolean index); String getIndexName(String tableName); void setIndexName(String indexName); boolean isUniqueIndex(); void setUniqueIndex(boolean uniqueIndex); String getUniqueIndexName(String tableName); void setUniqueIndexName(String uniqueIndexName); void setForeignAutoRefresh(boolean foreignAutoRefresh); boolean isForeignAutoRefresh(); int getMaxForeignAutoRefreshLevel(); void setMaxForeignAutoRefreshLevel(int maxForeignLevel); boolean isForeignCollection(); void setForeignCollection(boolean foreignCollection); boolean isForeignCollectionEager(); void setForeignCollectionEager(boolean foreignCollectionEager); int getForeignCollectionMaxEagerLevel(); void setForeignCollectionMaxEagerLevel(int foreignCollectionMaxEagerLevel); String getForeignCollectionColumnName(); void setForeignCollectionColumnName(String foreignCollectionColumn); String getForeignCollectionOrderColumnName(); void setForeignCollectionOrderColumnName(String foreignCollectionOrderColumn); boolean isForeignCollectionOrderAscending(); void setForeignCollectionOrderAscending(boolean foreignCollectionOrderAscending); String getForeignCollectionForeignFieldName(); void setForeignCollectionForeignFieldName(String foreignCollectionForeignFieldName); Class<? extends DataPersister> getPersisterClass(); void setPersisterClass(Class<? extends DataPersister> persisterClass); boolean isAllowGeneratedIdInsert(); void setAllowGeneratedIdInsert(boolean allowGeneratedIdInsert); String getColumnDefinition(); void setColumnDefinition(String columnDefinition); boolean isForeignAutoCreate(); void setForeignAutoCreate(boolean foreignAutoCreate); boolean isVersion(); void setVersion(boolean version); String getForeignColumnName(); void setForeignColumnName(String foreignColumnName); boolean isReadOnly(); void setReadOnly(boolean readOnly); static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field); static Method findGetMethod(Field field, boolean throwExceptions); static Method findSetMethod(Field field, boolean throwExceptions); static DatabaseFieldConfig fromDatabaseField(DatabaseType databaseType, String tableName, Field field,
			DatabaseField databaseField); void postProcess(); static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName); static final Class<? extends DataPersister> DEFAULT_PERSISTER_CLASS; static final DataType DEFAULT_DATA_TYPE; static final boolean DEFAULT_CAN_BE_NULL; static final boolean DEFAULT_FOREIGN_COLLECTION_ORDER_ASCENDING; static final int NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED; }