public abstract class AbstractBeanInitializer extends java.lang.Object implements IBeanInitializer
Modifier and Type | Field and Description |
---|---|
static Logger |
logger |
LOAD_2ONE_2MANY_WILDCARD, LOAD_2ONE_WILDCARD
Constructor and Description |
---|
AbstractBeanInitializer() |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.Class<? extends CdmBase>,AutoPropertyInitializer<CdmBase>> |
getBeanAutoInitializers() |
static java.util.Set<java.beans.PropertyDescriptor> |
getProperties(java.lang.Object bean,
java.util.Set<java.lang.Class<?>> typeRestrictions)
Return all public bean properties exclusive those whose return type
match any class defined in the parameter
typeRestrictions
or which are transient properties. |
void |
initialize(java.lang.Object bean,
java.util.List<java.lang.String> propertyPaths)
Allows more fine grained initialization not only of the root bean
identified by its
uuid but also of specific paths of
the object graph. |
<C extends java.util.Collection<?>> |
initializeAll(C beanList,
java.util.List<java.lang.String> propertyPaths)
Initializes the entities given in the bean list according to the given
propertyPaths . |
protected void |
initializeAllEntries(java.util.Collection collection,
boolean cdmEntities,
boolean collections) |
void |
initializeBean(java.lang.Object bean,
boolean cdmEntities,
boolean collections)
Initializes all *toOne relations of the given bean and all *toMany
relations, depending on the state of the boolean parameters
cdmEntities and collections |
abstract java.lang.Object |
initializeInstance(java.lang.Object proxy)
Initialize the the proxy, unwrap the target object and return it.
|
protected void |
initializePropertyPath(java.lang.Object bean,
java.lang.String propPath)
Initializes the given single
propPath String. |
protected java.lang.Object |
invokeInitialization(java.lang.Object bean,
java.beans.PropertyDescriptor propertyDescriptor)
Initializes the property of the given bean and returns the bean which is returned be that property.
|
protected void |
invokePropertyAutoInitializers(java.lang.Object bean) |
void |
load(java.lang.Object bean)
Initializes all *ToOne relations of the
bean . |
void |
loadFully(java.lang.Object bean)
Initializes all *ToOne and all *ToMany relations of the
bean . |
void |
setBeanAutoInitializers(java.util.Map<java.lang.Class<? extends CdmBase>,AutoPropertyInitializer<CdmBase>> beanAutoInitializers) |
protected void |
setProperty(java.lang.Object object,
java.lang.String property,
java.lang.Object value) |
public static final Logger logger
public void setBeanAutoInitializers(java.util.Map<java.lang.Class<? extends CdmBase>,AutoPropertyInitializer<CdmBase>> beanAutoInitializers)
beanAutoInitializers
- the beanAutoInitializers to setpublic java.util.Map<java.lang.Class<? extends CdmBase>,AutoPropertyInitializer<CdmBase>> getBeanAutoInitializers()
public abstract java.lang.Object initializeInstance(java.lang.Object proxy)
IBeanInitializer
initializeInstance
in interface IBeanInitializer
proxy
- the proxy to initialize may wrap a single bean or a collectionpublic void load(java.lang.Object bean)
IBeanInitializer
bean
.load
in interface IBeanInitializer
public void loadFully(java.lang.Object bean)
IBeanInitializer
bean
.loadFully
in interface IBeanInitializer
public void initializeBean(java.lang.Object bean, boolean cdmEntities, boolean collections)
cdmEntities
and collections
bean
- the bean to initializecdmEntities
- initialize all *toOne relations to cdm entitiescollections
- initialize all *toMany relationspublic void initialize(java.lang.Object bean, java.util.List<java.lang.String> propertyPaths)
IBeanInitializer
uuid
but also of specific paths of
the object graph. The sub graph to initialize may be defined in the
propertyPaths
parameter as list of paths all starting at the
root bean.
You can use wildcards *
LOAD_2ONE_2MANY_WILDCARD
and $
LOAD_2ONE_WILDCARD
for initializing
all *ToOne and all *ToMany relations of a bean.
NOTE: A wildcard subsequently terminates its property path.
Example: Assuming cdmEntity
is a Taxon
instance the following propertyPaths
can be used for
initializing bean properties of this instance. It is possible to
initialized nested properties of properties with unlimited depth.
name
: initializes TaxonBase.getName()
name.rank
: initializes TaxonBase.getName()
.getRank()
name.$
: initializes all *ToOne relations of the TaxonBase.getName()
initialize
in interface IBeanInitializer
propertyPaths
- a List of property namespublic <C extends java.util.Collection<?>> C initializeAll(C beanList, java.util.List<java.lang.String> propertyPaths)
IBeanInitializer
propertyPaths
.initializeAll
in interface IBeanInitializer
protected void initializePropertyPath(java.lang.Object bean, java.lang.String propPath)
propPath
String.bean
- propPath
- protected java.lang.Object invokeInitialization(java.lang.Object bean, java.beans.PropertyDescriptor propertyDescriptor) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
bean
- propertyDescriptor
- java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
protected final void invokePropertyAutoInitializers(java.lang.Object bean)
beanClass
- bean
- protected void setProperty(java.lang.Object object, java.lang.String property, java.lang.Object value)
protected void initializeAllEntries(java.util.Collection collection, boolean cdmEntities, boolean collections)
collection
- of which all entities are to be initializedcdmEntities
- initialize all *toOne relations to cdm entitiescollections
- initialize all *toMany relationspublic static java.util.Set<java.beans.PropertyDescriptor> getProperties(java.lang.Object bean, java.util.Set<java.lang.Class<?>> typeRestrictions)
typeRestrictions
or which are transient properties.bean
- typeRestrictions
- Copyright © 2007-2020 EDIT. All Rights Reserved.