public class ConstructorBeanProvider extends SimpleBeanProvider
A simple bean provider that creates new bean instances by invoking a constructor.
This BeanProvider
class is initialized with a
ConstructorInvocation
object. The
getBean()
method will trigger this invocation object and
return the newly created instance.
The ConstructorInvocation
also determines the dependencies of
this bean provider: these are the parameters to be passed to the constructor,
which can be arbitrary other beans defined in the current bean store.
A ConstructorBeanProvider
is intended to be used together with
another life-cycle-aware bean provider. It will then be used for creating new
bean instances while its owning bean provider is responsible for further
initialization and life-cycle support.
Constructor and Description |
---|
ConstructorBeanProvider(ConstructorInvocation ctorinv)
Creates a new instance of
ConstructorBeanProvider and
initializes it with the constructor invocation to be called. |
Modifier and Type | Method and Description |
---|---|
Object |
getBean(DependencyProvider dependencyProvider)
Returns the bean managed by this provider.
|
Class<?> |
getBeanClass(DependencyProvider dependencyProvider)
Returns the class of the managed bean.
|
Set<Dependency> |
getDependencies()
Returns the dependencies of this bean provider.
|
ConstructorInvocation |
getInvocation()
Returns the
ConstructorInvocation object that determines
the constructor to be invoked. |
String |
toString()
Returns a string representation of this object.
|
getLockID, isBeanAvailable, setLockID, shutdown
public ConstructorBeanProvider(ConstructorInvocation ctorinv)
ConstructorBeanProvider
and
initializes it with the constructor invocation to be called. This object
specifies the constructor to be invoked.ctorinv
- the ConstructorInvocation
(must not be
null)IllegalArgumentException
- if the constructor invocation is
undefinedpublic ConstructorInvocation getInvocation()
ConstructorInvocation
object that determines
the constructor to be invoked.public Object getBean(DependencyProvider dependencyProvider)
dependencyProvider
- the dependency providerInjectionException
- if an error occurs when
creating the beanpublic Class<?> getBeanClass(DependencyProvider dependencyProvider)
dependencyProvider
- the dependency providerpublic Set<Dependency> getDependencies()
getDependencies
in interface BeanProvider
getDependencies
in class SimpleBeanProvider
Dependency
Copyright © 2016 The JGUIraffe Team. All rights reserved.