public class BeanConfig extends Object
| Constructor and Description |
|---|
BeanConfig(Class<? extends Object> beanClass,
String tableName)
Creates a configuration for a bean represented by the given class.
|
| Modifier and Type | Method and Description |
|---|---|
<E> BeanConfig |
abstractInstance(E abstractProperty,
Class<? extends E> clazz)
Configures a class that should be used instead of property type to create instances
through
Class.newInstance() method. |
BeanConfig |
abstractInstance(String abstractProperty,
Class<? extends Object> clazz)
Configures a class that should be used instead of property type to create instances
through
Class.newInstance() method. |
BeanConfig |
addSequenceName(String seqNameInDb)
Add the sequence name *in the database* that will be used for this field.
|
BeanConfig |
field(Object propValueFromGetter,
DBType<? extends Object> type) |
BeanConfig |
field(Object propValueFromGetter,
String dbName,
DBType<? extends Object> type) |
BeanConfig |
field(String name,
DBType<? extends Object> type)
Add a database field for the given property with the given database type.
|
BeanConfig |
field(String name,
String dbName,
DBType<? extends Object> type)
Add a database field for the given property with the given database type.
|
Iterator<DBField> |
fields()
Return all DBFields configured for this bean.
|
Class<? extends Object> |
getAbstractProperty(String key) |
DBField |
getAutoIncrementField()
Return an auto-increment field, if one was configured for this bean.
|
Class<? extends Object> |
getBeanClass()
Return the bean class.
|
TriggerDispatcher |
getDispatcher() |
DBField |
getField(String name) |
int |
getNumberOfFields()
Return the number of fields configured for this bean.
|
int |
getNumberOfPKs() |
DBField |
getSequenceField()
Return a sequence field, if one was configured for this bean.
|
String |
getSequenceName()
Returns the name of the sequence in the database.
|
String |
getTableName()
Return the table name where the bean properties are stored.
|
boolean |
hasPK()
Check whether the primary key was defined.
|
BeanConfig |
pk(Object propValueFromGetter,
DBType<? extends Object> type) |
BeanConfig |
pk(Object propValueFromGetter,
String dbName,
DBType<? extends Object> type) |
BeanConfig |
pk(String name,
DBType<? extends Object> type)
Add a bean property that is the primary key in the database.
|
BeanConfig |
pk(String name,
String dbName,
DBType<? extends Object> type)
Add a property that is the primary key in the database.
|
Iterator<DBField> |
pks()
Return an iterator with the DBFields for the PK configured for this bean.
|
BeanConfig |
remove(Object propValueFromGetter) |
BeanConfig |
remove(String name) |
BeanConfig |
remove(TriggerListener trigger) |
BeanConfig |
seq(String seqNameInDb)
Alias for method addSequence
|
String |
toString() |
BeanConfig |
trigger(TriggerListener trigger) |
public String getTableName()
public Class<? extends Object> getBeanClass()
public BeanConfig addSequenceName(String seqNameInDb)
seqNameInDb - the name of the sequence in the databasepublic BeanConfig seq(String seqNameInDb)
seqNameInDb - public String getSequenceName()
public BeanConfig remove(String name)
public BeanConfig remove(Object propValueFromGetter)
public DBField getAutoIncrementField()
public DBField getSequenceField()
public BeanConfig field(String name, DBType<? extends Object> type)
name - The bean property name (same as the database column name)type - The database typepublic BeanConfig field(Object propValueFromGetter, DBType<? extends Object> type)
public BeanConfig field(String name, String dbName, DBType<? extends Object> type)
name - The bean property namedbName - The name of the database column holding this propertytype - The database typepublic BeanConfig field(Object propValueFromGetter, String dbName, DBType<? extends Object> type)
public BeanConfig pk(String name, DBType<? extends Object> type)
name - The bean property nametype - The database typepublic BeanConfig pk(Object propValueFromGetter, DBType<? extends Object> type)
public BeanConfig pk(String name, String dbName, DBType<? extends Object> type)
name - The bean property namedbName - The name of the database column holding this propertytype - The database typepublic BeanConfig pk(Object propValueFromGetter, String dbName, DBType<? extends Object> type)
public int getNumberOfFields()
public int getNumberOfPKs()
public Iterator<DBField> fields()
public boolean hasPK()
public Iterator<DBField> pks()
public BeanConfig trigger(TriggerListener trigger)
public BeanConfig remove(TriggerListener trigger)
public TriggerDispatcher getDispatcher()
public BeanConfig abstractInstance(String abstractProperty, Class<? extends Object> clazz)
Class.newInstance() method. It's useful when working with abstract objectsabstractProperty - - The property nameclazz - - The concrete classpublic <E> BeanConfig abstractInstance(E abstractProperty, Class<? extends E> clazz)
Class.newInstance() method. It's useful when working with abstract objectsabstractProperty - - The property name (through proxy)clazz - - The concrete classCopyright © 2016. All Rights Reserved.