P
- init-param typepublic class BeanInitializer<P> extends Object
If the passed parameters are not directly suitable for initialization, other parameters may also be derived and used instead.
P
(the current parameters).
P
(the current
parameters).
Constructor and Description |
---|
BeanInitializer(Class<?> initializationType)
Simpler case where only the current-parameters can be initialized, but for no further
property-types.
|
BeanInitializer(Class<?> initializationType,
List<ExtractDerivedParameter<P,?>> extractersToAdd)
More complex-case where both current-parameters and other extracted property-types can be
initialized.
|
Modifier and Type | Method and Description |
---|---|
boolean |
applyInitializationIfPossibleTo(Object bean,
Object parent,
Logger logger)
Applies the initialization to a bean if possible.
|
Class<?> |
getInitializationType()
Type of parameters to be propagated, corresponding to
P . |
void |
setParam(P param)
Sets the current parameters used for propagation.
|
public BeanInitializer(Class<?> initializationType)
initializationType
- type of parameters to be propagated, corresponding to <P>
.public BeanInitializer(Class<?> initializationType, List<ExtractDerivedParameter<P,?>> extractersToAdd)
initializationType
- type of parameters to be propagated, corresponding to <P>
.extractersToAdd
- extracters to used for other property-types that can be derived from
current property-type.public void setParam(P param)
param
- the parameters to be assigned, and to be propagated into initialized beans.public boolean applyInitializationIfPossibleTo(Object bean, Object parent, Logger logger) throws InitializeException
As a prerequisite, setParam(Object)
must be called before calling this method.
Initialization is possible if either the parameters set above, or derived parameters are of acceptable type.
bean
- the bean to be initialized.parent
- the parent bean of bean
.logger
- logger for any errors.InitializeException
- if initialization could not successfully complete.public Class<?> getInitializationType()
P
.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.