|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sibvisions.rad.persist.bean.BeanConverter
public class BeanConverter
The BeanConverter class allows to convert between Object[]s,
IBeans and POJOs.
This class keeps three important pieces in sync:
IBeanType which is used for many operations.IBeanType.
| Constructor Summary | |
|---|---|
BeanConverter()
Creates a new instance of BeanConverter. |
|
BeanConverter(IBeanType pBeanType)
Creates a new instance of BeanConverter. |
|
| Method Summary | ||
|---|---|---|
java.lang.Object[] |
createArray(java.lang.Object pObject)
Creates an array of values from a given object. |
|
IBean |
createBean(java.lang.Object pPOJO)
Creates a bean from the given POJO. |
|
IBean |
createBean(java.lang.Object[] pValues)
Creates a bean with given values. |
|
IBean |
createEmptyBean()
Creates a new bean with all column names from the meta data. |
|
|
createPOJO(java.lang.Class<T> pClass,
IBean pBean)
Creates a POJO from the given type and with the values from a bean. |
|
|
createPOJO(java.lang.Class<T> pClass,
java.lang.Object pPOJO)
Creates a POJO from the given type and with the values from a POJO. |
|
|
createPOJO(java.lang.Class<T> pClass,
java.lang.Object[] pValues)
Creates a POJO from the given type and with given values. |
|
IBeanType |
getBeanType()
Gets the IBeanType used by this BeanConverter. |
|
java.lang.String |
getPojoPropertyName(int pIndex)
Returns the POJO property name at the given index. |
|
java.lang.String |
getPropertyNameForColumn(java.lang.String pColumnName)
Gets the property name (Java standard) for the given column name. |
|
boolean |
isInitialized()
Returns true if this BeanConverter has been initialized. |
|
void |
removePropertyNameForColumn(java.lang.String pColumnName)
Removes the given column name. |
|
void |
setBeanType(IBeanType pBeanType)
Sets the given IBeanType. |
|
void |
setPojoPropertyName(int pIndex,
java.lang.String pPropertyName)
Sets the given POJO property name at the given index. |
|
void |
setPropertyNameForColumn(java.lang.String pColumnName,
java.lang.String pPropertyName)
Sets the property name (Java standard) for a given column name. |
|
void |
updateArray(java.lang.Object[] pArray,
java.lang.Object pPOJO)
Updates the array with the values from the POJO. |
|
void |
updateBean(IBean pBean,
java.lang.Object pPOJO)
Updates a bean with values from a POJO. |
|
void |
updateBean(IBean pBean,
java.lang.Object[] pValues)
Updates a bean with values from an array. |
|
void |
updatePOJO(java.lang.Object pPOJO,
java.lang.Object pNewPOJO)
Updates a POJO with values from a POJO. |
|
void |
updatePOJO(java.lang.Object pPOJO,
java.lang.Object[] pValues)
Updates a POJO with values from an array. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BeanConverter()
BeanConverter.
Note that the created instance is still missing a IBeanType, so
it needs to be set afterwards.
public BeanConverter(IBeanType pBeanType)
BeanConverter.
pBeanType - the IBeanType to use.| Method Detail |
|---|
public java.lang.Object[] createArray(java.lang.Object pObject)
pObject - a POJO or bean
public IBean createBean(java.lang.Object[] pValues)
pValues - the values in same order as the meta data
public IBean createBean(java.lang.Object pPOJO)
pPOJO - the POJO from which to create the bean.
public IBean createEmptyBean()
IBean implementation
public <T> T createPOJO(java.lang.Class<T> pClass,
IBean pBean)
T - the type of the POJOpClass - the class of the POJOpBean - the bean with values for the POJO
public <T> T createPOJO(java.lang.Class<T> pClass,
java.lang.Object pPOJO)
T - the type of the POJOpClass - the class of the POJOpPOJO - the POJO for the POJO
public <T> T createPOJO(java.lang.Class<T> pClass,
java.lang.Object[] pValues)
T - the type of the POJOpClass - the class of the POJOpValues - the values for the properties in the same order as the
meta data
public IBeanType getBeanType()
IBeanType used by this BeanConverter. Might
return null if this hasn't been initialized by now.
IBeanType. null if this hasn't been
initialized.public java.lang.String getPojoPropertyName(int pIndex)
pIndex - the index of the property.
public java.lang.String getPropertyNameForColumn(java.lang.String pColumnName)
pColumnName - the column name e.g. FIRST_NAME
public boolean isInitialized()
true if this BeanConverter has been initialized.
true if this is initialized.public void removePropertyNameForColumn(java.lang.String pColumnName)
pColumnName - the column name to remove.public void setBeanType(IBeanType pBeanType)
IBeanType.
pBeanType - the IBeanType to use.
public void setPojoPropertyName(int pIndex,
java.lang.String pPropertyName)
pIndex - the index at which to set the name.pPropertyName - the POJO property name.
public void setPropertyNameForColumn(java.lang.String pColumnName,
java.lang.String pPropertyName)
pColumnName - the column namepPropertyName - the java property name e.g. firstName instead of
FIRST_NAME
public void updateArray(java.lang.Object[] pArray,
java.lang.Object pPOJO)
pArray - the array.pPOJO - the POJO.
public void updateBean(IBean pBean,
java.lang.Object pPOJO)
pBean - the beanpPOJO - the POJO (or IBean)
public void updateBean(IBean pBean,
java.lang.Object[] pValues)
pBean - the bean.pValues - the array.
public void updatePOJO(java.lang.Object pPOJO,
java.lang.Object pNewPOJO)
pPOJO - the POJO to update.pNewPOJO - the new POJO.
public void updatePOJO(java.lang.Object pPOJO,
java.lang.Object[] pValues)
pPOJO - the POJO to update.pValues - the array.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||