B
- type de l'entitepublic class EntityOperator<B extends TopiaEntity> extends Object
get(String, TopiaEntity)
set(String, TopiaEntity, Object)
copy(String, TopiaEntity, TopiaEntity)
getChild(String, TopiaEntity, String)
addChild(String, TopiaEntity, Object)
removeChild(String, TopiaEntity, Object)
...
D'autres methodes permettent d'effectuer des operations en lot (sur plusieurs
proprietes en meme temps) sur les proprietes :
copyProperties(TopiaEntity, TopiaEntity, boolean, String...)
obtainProperties(TopiaEntity, String...)
clearProperties(TopiaEntity, String...)
Note : cet objet ne permet pas d'operation vers les bases.Modifier and Type | Field and Description |
---|---|
protected List<String> |
associationProperties
list of association names available on the entity.
|
protected Method[] |
childAddAllMethods
cache of assocation
addAll methods. |
protected Method[] |
childAddMethods
cache of assocation
add methods. |
protected Method[] |
childClearMethods
cache of assocation
clear methods. |
protected Method[] |
childGetMethods
cache of assocation
get methods. |
protected Method[] |
childIsEmptyMethods
cache of assocation
isEmpty methods. |
protected Method[] |
childRemoveMethods
cache of assocation
remove methods. |
protected Method[] |
childSizeMethods
cache of assocation
size methods. |
protected TopiaEntityEnum |
contract
the constant of the entity
|
protected Method[] |
getMethods
cache of getter methods.
|
protected Set<String> |
naturalIdsOnNotNullsProperties
list of property names available on the entity used in a natural ids or
marked as not-null.
|
protected List<String> |
properties
list of property names available on the entity.
|
protected Method[] |
setMethods
cache of setter methods.
|
protected static Integer |
ZERO
Deprecated.
|
protected static Byte |
ZEROB
Deprecated.
|
protected static Character |
ZEROC
Deprecated.
|
protected static Double |
ZEROD
Deprecated.
|
protected static Float |
ZEROF
Deprecated.
|
protected static Long |
ZEROL
Deprecated.
|
Modifier | Constructor and Description |
---|---|
protected |
EntityOperator(TopiaEntityEnum contract) |
Modifier and Type | Method and Description |
---|---|
void |
addAllChild(String name,
B bean,
Collection<?> childs)
Ajoute toutes les entites d'association.
|
void |
addChild(String name,
B bean,
Object child)
Ajoute une entite d'association.
|
void |
clearChild(String name,
B bean)
Retire toutes les entites d'association.
|
void |
clearProperties(B from,
String... properties)
Met a null toutes les proprietes donnees.
|
Object |
clone() |
void |
copy(String name,
B from,
B dst)
Copie une propriete de src vers dst.
|
void |
copyProperties(B from,
B dst,
boolean tech,
String... properties)
Recopie toutes les proprietes donnes depuis src vers dst.
|
boolean |
equals(Object obj) |
protected void |
finalize() |
Object |
get(String name,
B bean)
Recupere la valeur de la propriete donnee.
|
List<String> |
getAssociationProperties() |
protected Class<?> |
getAssociationPropertyType(int index) |
Class<?> |
getAssociationPropertyType(String name) |
Object |
getChild(String name,
B bean,
String topiaId)
Recupere une entite d'association a partir de son id.
|
Class<B> |
getClazz() |
Map<String,Object> |
getNaturalId(B bean)
Pour obtenir un dictionnaire de la clef naturelle (clef métier) du
bean
donne. |
String[] |
getNaturalIdsOnNotNullsProperties()
Get all properties from a natural id or marked as not-null.
|
Map<String,Object> |
getNaturalIsdAndNotNulls(B bean)
Pour obtenir un dictionnaire des propriétés marqués not-null et la clef naturelle
du
bean donne. |
Map<String,Object> |
getNotNull(B bean)
Pour obtenir un dictionnaire des propriétés marqués not-null du
bean donne. |
static Object |
getNullValue(Class<?> type)
Deprecated.
since 2.6 (there is some other library which does it
|
List<String> |
getProperties() |
protected Collection<String> |
getProperties(String[] properties) |
protected Class<?> |
getPropertyType(int index) |
Class<?> |
getPropertyType(String name) |
int |
hashCode() |
protected void |
init() |
protected void |
init(Class<?> entityClass,
Set<Class<?>> explored,
List<String> properties,
List<String> associationProperties,
List<Method> getters,
List<Method> setters,
List<Method> childGetters,
List<Method> childAdders,
List<Method> childAddersAll,
List<Method> childRemovers,
List<Method> childSize,
List<Method> childClearers,
List<Method> childIsEmpty) |
protected static void |
invoke(Method m,
Object bean,
Object... args) |
protected static <V> V |
invokeWithResult(Method m,
Object bean,
Object... args) |
boolean |
isChildEmpty(String name,
B bean)
Test s'il existe des entites d'association pour la propriete donnee.
|
protected B |
newInstance() |
Map<String,Object> |
obtainProperties(B from,
String... properties)
Obtenir dans un dictionnaire, les valeurs des proprietes donnees.
|
void |
removeChild(String name,
B bean,
Object child)
Retire une entite d'association.
|
void |
set(String name,
B bean,
Object value)
Positionner la valeur donne de la propriete donnee.
|
void |
setNull(String name,
B bean)
Positionner la valeur nulle de la propriete donnee.
|
int |
sizeChild(String name,
B bean)
Retourne le nombre d'entite d'association.
|
String |
toString() |
protected final TopiaEntityEnum contract
protected Set<String> naturalIdsOnNotNullsProperties
protected List<String> associationProperties
protected Method[] getMethods
protected Method[] setMethods
protected Method[] childGetMethods
get
methods.protected Method[] childAddMethods
add
methods.protected Method[] childAddAllMethods
addAll
methods.protected Method[] childRemoveMethods
remove
methods.protected Method[] childSizeMethods
size
methods.protected Method[] childIsEmptyMethods
isEmpty
methods.protected Method[] childClearMethods
clear
methods.@Deprecated protected static final Integer ZERO
@Deprecated protected static final Character ZEROC
@Deprecated protected static final Float ZEROF
@Deprecated protected static final Long ZEROL
@Deprecated protected static final Double ZEROD
@Deprecated protected static final Byte ZEROB
protected EntityOperator(TopiaEntityEnum contract)
public Object get(String name, B bean)
getXXX()
.name
- le nom de la proprietebean
- l'instance a interrogerpublic void set(String name, B bean, Object value)
setXXX(value)
.name
- le nom de la proprietebean
- l'instance a mettre a jourvalue
- la valeur a positionnerpublic Map<String,Object> getNaturalId(B bean)
bean
donne.bean
- le bean a inspecterTopiaEntityEnum.getNaturalIds()
public Map<String,Object> getNotNull(B bean)
bean
donne.bean
- le bean a inspecterTopiaEntityEnum.getNotNulls()
public String[] getNaturalIdsOnNotNullsProperties()
public Map<String,Object> getNaturalIsdAndNotNulls(B bean)
bean
donne.
Cette methode est utilisée pour faire un dao.create, pour s'assurer que
tout ce qui ne doit pas pas être à null est bien fourni à la création de
l'objet, sinon on obtient des erreurs.bean
- le bean a inspecterTopiaEntityEnum.getNotNulls()
,
TopiaEntityEnum.getNaturalIds()
public void copy(String name, B from, B dst)
setXXX(value)
.name
- le nom de la proprietefrom
- l'instance a interrogerdst
- l'instance a mettre a jourpublic void setNull(String name, B bean)
setXXX(nullValue)
.name
- le nom de la proprietebean
- l'instance a mettre a jour@Deprecated public static Object getNullValue(Class<?> type)
type
- the type to testnull
value or default value for primitive typesDefaults
public Object getChild(String name, B bean, String topiaId)
getXXXByTopiaId(topiaId)
.name
- le nom de la propriete d'associationbean
- l'instance a interrogertopiaId
- l'id de l'entite rechercheepublic boolean isChildEmpty(String name, B bean)
isXXXEmpty()
.name
- le nom de la propriete d'associationbean
- l'instance a interrogertrue
si pas d'entite d'associationpublic void addChild(String name, B bean, Object child)
addXXX(child)
.name
- le nom de la propriete d'associationbean
- l'instance a mettre a jourchild
- l'entite a ajouterpublic void addAllChild(String name, B bean, Collection<?> childs)
addXXX(child)
.name
- le nom de la propriete d'associationbean
- l'instance a mettre a jourchilds
- les entites a ajouterpublic void removeChild(String name, B bean, Object child)
removeXXX(child)
.name
- le nom de la propriete d'associationbean
- l'instance a mettre a jourchild
- l'entite a retirerpublic int sizeChild(String name, B bean)
sizeXXX(childs)
.name
- le nom de la propriete d'associationbean
- l'instance a mettre a jourpublic void clearChild(String name, B bean)
clearXXX(childs)
.name
- le nom de la propriete d'associationbean
- l'instance a mettre a jourpublic void copyProperties(B from, B dst, boolean tech, String... properties)
from
- l'entite a interrogerdst
- l'entite a mettre a jourtech
- un drapeau pour recopier aussi les infos techniquesproperties
- les proprietes a recopierpublic Map<String,Object> obtainProperties(B from, String... properties)
from
- l'object a scanneproperties
- les proprietes a retenir (vide si on les veut toutes)public void clearProperties(B from, String... properties)
from
- l'object a scanneproperties
- les proprietes a retenir (vide si on les veut toutes)protected void finalize() throws Throwable
protected Collection<String> getProperties(String[] properties)
protected Class<?> getPropertyType(int index)
protected Class<?> getAssociationPropertyType(int index)
protected B newInstance()
protected void init()
protected void init(Class<?> entityClass, Set<Class<?>> explored, List<String> properties, List<String> associationProperties, List<Method> getters, List<Method> setters, List<Method> childGetters, List<Method> childAdders, List<Method> childAddersAll, List<Method> childRemovers, List<Method> childSize, List<Method> childClearers, List<Method> childIsEmpty) throws IntrospectionException
IntrospectionException
Copyright © 2004–2022 Code Lutin. All rights reserved.