|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mentabean.BeanConfig
public class BeanConfig
A class representing a bean configuration, like table name, primary keys and fields in the database.
| Constructor Summary | |
|---|---|
BeanConfig(Class<? extends Object> beanClass,
String tableName)
Creates a configuration for a bean represented by the given class. |
|
| Method Summary | |
|---|---|
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. |
DBField |
getAutoIncrementField()
Return an auto-increment field, if one was configured for this bean. |
Class<? extends Object> |
getBeanClass()
Return the bean class. |
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 |
seq(String seqNameInDb)
Alias for method addSequence |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BeanConfig(Class<? extends Object> beanClass,
String tableName)
beanClass - The bean klasstableName - The database table where the bean properties will be stored.| Method Detail |
|---|
public String getTableName()
public Class<? extends Object> getBeanClass()
public BeanConfig addSequenceName(String seqNameInDb)
seqNameInDb - the name of the sequence in the database
public 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 type
public 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 type
public 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 type
public 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 type
public BeanConfig pk(Object propValueFromGetter,
String dbName,
DBType<? extends Object> type)
public int getNumberOfFields()
public int getNumberOfPKs()
public String toString()
toString in class Objectpublic Iterator<DBField> fields()
public boolean hasPK()
public Iterator<DBField> pks()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||