B
- bean-family typeP
- initialization-parameters typepublic abstract class InitializableBean<B,P extends BeanInitialization> extends AnchorBean<B>
Modifier | Constructor and Description |
---|---|
protected |
InitializableBean(BeanInitializer<P> beanInitializer,
InitializationParameterAssigner propertyInitializer) |
Modifier and Type | Method and Description |
---|---|
protected P |
getInitialization()
The parameters used for initialization.
|
protected Logger |
getLogger()
The logger.
|
InitializationParameterAssigner |
getPropertyInitializer()
Assigns a parameter, if possible, to a bean - as used by
bean initializer . |
void |
initialize(P parameters,
Logger logger)
Initializes the bean with the necessary parameters.
|
void |
initializeRecursive(P parameters,
Logger logger)
Initializes this object, and all children objects, so long as they have
P once a Bean
doesn't have P , the children are not evaluated. |
void |
initRecursiveWithInitializer(BeanInitializer<?> initializer,
Logger logger)
Initializes the bean and recursively all contained beans (who have compatible initialization
requirements)
|
boolean |
isInitialized()
Has the been already been initialized via a call to
initialize(BeanInitialization,
Logger) or similar. |
void |
onInitialization(P initialization)
Called after initialization.
|
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise, toString
protected InitializableBean(BeanInitializer<P> beanInitializer, InitializationParameterAssigner propertyInitializer)
public void initialize(P parameters, Logger logger) throws InitializeException
This method should always be called once before using the other methods of the bean.
parameters
- parameters to initialize with.logger
- a logger for events.InitializeException
- if initialization cannot complete successfully.public void onInitialization(P initialization) throws InitializeException
initialization
- parameters used for initialization.InitializeException
- if initialization does not successfully complete.public void initRecursiveWithInitializer(BeanInitializer<?> initializer, Logger logger) throws InitializeException
initializer
- the property-initializer to use.logger
- logger.InitializeException
- if the initialization fails, including if correct
initialization-parameters cannot be derived.public void initializeRecursive(P parameters, Logger logger) throws InitializeException
P
once a Bean
doesn't have P
, the children are not evaluated.parameters
- the parameters to initialize with.logger
- logger.InitializeException
- if the initialization fails.public boolean isInitialized()
initialize(BeanInitialization,
Logger)
or similar.protected Logger getLogger()
protected P getInitialization() throws InitializeException
InitializeException
- if the bean has not been initialized.public InitializationParameterAssigner getPropertyInitializer()
bean initializer
.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.