|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.beanlet.BeanletApplicationContext
public abstract class BeanletApplicationContext
Bootstrap class for the application container. An instance of the
BeanletApplicationContext can be obtained through the static
instance method. If the container isn't already running, the
first call to this method automatically starts and initializes the container.
During initialization, the container registers the beanlets listed in all
the beanlet.xml and META-INF/beanlet.xml files that are
available from the container's classpath.
The beanlet application context providess access to all registered beanlets. All methods of this class are thread-safe. They can be called at all time. That includes during initialization of the application container.
| Constructor Summary | |
|---|---|
BeanletApplicationContext()
|
|
| Method Summary | ||
|---|---|---|
abstract boolean |
exists(String beanletName)
Returns true if a beanlet exists for the specified
beanletName. |
|
abstract Object |
getBeanlet(String beanletName)
Returns a beanlet instance for the specified beanletName. |
|
abstract
|
getBeanlet(String beanletName,
Class<T> requiredType)
Returns a beanlet instance for the specified beanletName. |
|
abstract
|
getBeanlet(String beanletName,
Class<T> requiredType,
Map<String,?> info)
Returns a BeanletFactory for the specified beanletName. |
|
abstract Object |
getBeanlet(String beanletName,
Map<String,?> info)
Returns a beanlet for the specified beanletName. |
|
abstract BeanletFactory<?> |
getBeanletFactory(String beanletName)
Returns a BeanletFactory for the specified beanletName,
or throws a BeanletNotFoundException if beanlet does not exist. |
|
abstract
|
getBeanletFactory(String beanletName,
Class<T> requiredType)
Returns a BeanletFactory for the specified beanletName. |
|
abstract Set<String> |
getBeanletNames()
Returns an immutable set of beanlet names of all registered beanlets. |
|
abstract Set<String> |
getBeanletNamesForType(Class<?> type)
Returns an immutable set of beanlet names of all registered beanlets, which the beanlet instance type is the same as, or a subclass of the specified type. |
|
abstract Set<String> |
getBeanletNamesForType(Class<?> type,
boolean factoryAware,
boolean usePrefix)
Returns an immutable set of beanlet names of all registered beanlets, which the beanlet instance type is the same as, or a subclass of the specified type. |
|
abstract
|
getEvent(Class<T> eventType)
Factory method for the specified eventType. |
|
static BeanletApplicationContext |
instance()
Returns a BeanletApplicationContext instance. |
|
protected BeanletApplicationContext |
resolveInstance()
Subclasses of this class can implement this method to control which instance is returned to the caller of the static instance method. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BeanletApplicationContext()
| Method Detail |
|---|
public static BeanletApplicationContext instance()
throws BeanletApplicationException
Returns a BeanletApplicationContext instance. If the container
isn't already running, the first call to this method automatically starts
and initializes the container.
It is not specified whether multiple calls to this method results in
a single or multiple instances of the BeanletApplicationContext.
However, as the container only starts once, invoking this method multiple
times is valid and does not consume any additional resources.
BeanletApplicationContext instance.
BeanletApplicationException - indicates an error during container
initialization.
protected BeanletApplicationContext resolveInstance()
throws BeanletApplicationException
instance method.
The default implementation of this method simply returns this.
BeanletApplicationContext - indicates an error during container
initialization.
BeanletApplicationExceptionpublic abstract <T extends Event> T getEvent(Class<T> eventType)
eventType.
eventType.
public abstract Object getBeanlet(String beanletName)
throws BeanletNotFoundException,
BeanletCreationException
Returns a beanlet instance for the specified beanletName.
If his beanlet instance implements the FactoryBeanlet
interface, the result of FactoryBeanlet.getObject() is returned.
Prefix the beanletName with "&" to obtain an instance to
the FactoryBeanlet itself.
beanletName - name of the beanlet.
BeanletNotFoundException - if beanlet does not exist.
BeanletCreationException - if beanlet could not be created for any
reason.
public abstract <T> T getBeanlet(String beanletName,
Class<T> requiredType)
throws BeanletNotFoundException,
BeanletCreationException,
BeanletNotOfRequiredTypeException
Returns a beanlet instance for the specified beanletName. If
no beanlet exists for the specied beanletName a
BeanletNotFoundException is thrown. A
BeanletNotOfRequiredTypeException is thrown if the beanlet
instance cannot be assigned to the requiredType.
If his beanlet instance implements the FactoryBeanlet
interface, the result of FactoryBeanlet.getObject() is returned.
Prefix the beanletName with "&" to obtain an instance to
the FactoryBeanlet itself.
The entries of the info argument can be used to wire members
of the beanlet instance. This does not apply to singleton and stateless
beanlets.
beanletName - name of the beanlet.requiredType - type to mached the beanlet type.
BeanletNotFoundException - if beanlet does not exist.
BeanletCreationException - if beanlet could not be created for
any reason.
BeanletNotOfRequiredTypeException - if beanlet cannot be assigned
to the requiredType.Inject,
Wiring
public abstract Object getBeanlet(String beanletName,
Map<String,?> info)
throws BeanletNotFoundException,
BeanletCreationException
Returns a beanlet for the specified beanletName.
If this beanlet implements the FactoryBeanlet
interface, the result of FactoryBeanlet.getObject() is returned.
Prefix the beanletName with "&" to obtain an instance to
the FactoryBeanlet itself.
The entries of the info argument can be used to wire members
of the beanlet instance. This does not apply to static beanlets.
beanletName - name of the beanlet.info - map that contains parameters that can be injected into
the beanlet instance.
BeanletNotFoundException - if beanlet does not exist.
BeanletCreationException - if beanlet could not be
created for any reason.Inject,
Wiring
public abstract <T> T getBeanlet(String beanletName,
Class<T> requiredType,
Map<String,?> info)
throws BeanletNotFoundException,
BeanletCreationException,
BeanletNotOfRequiredTypeException
Returns a BeanletFactory for the specified beanletName.
If no beanlet exists for the specified beanletName a
BeanletNotFoundException is thrown. If the beanlet definition
type is either the same as, or a subclass of the specified
requiredType, a generified BeanletFactory is returned
with the requiredType as upper bound.
This method ignores the "&" prefix.
The entries of the info argument can be used to wire members
of the beanlet instance. This does not apply to static beanlets.
beanletName - name of the beanlet.requiredType - type to mached the beanlet type.info - map that contains parameters that can be injected into
the beanlet instance.
BeanletFactory for the specified beanletName.
BeanletNotFoundException - if beanlet does not exist.
BeanletCreationException - if beanlet could not be created for any
reason.
BeanletNotOfRequiredTypeException - if beanlet cannot be assigned
to the requiredType.Inject,
Wiringpublic abstract Set<String> getBeanletNames()
public abstract Set<String> getBeanletNamesForType(Class<?> type)
type.
type - type to mached the beanlet type.
public abstract Set<String> getBeanletNamesForType(Class<?> type,
boolean factoryAware,
boolean usePrefix)
type. Additionally, beanlet factories, which return
type match the specified type can be added as well, if
factoryAware is set to true. Set usePrefix to
true if these beanlet names must be prepended with "&".
type - type to mached the beanlet type, or factory
beanlet return type (optional).factoryAware - specify true to include factory beanlets,
which return type match the given type.usePrefix - specify true to prefix factory beanlet names.
public abstract BeanletFactory<?> getBeanletFactory(String beanletName)
throws BeanletNotFoundException
Returns a BeanletFactory for the specified beanletName,
or throws a BeanletNotFoundException if beanlet does not exist.
This method ignores the "&" prefix.
beanletName - name of the beanlet.
BeanletFactory for the specified beanletName.
BeanletNotFoundException - if beanlet does not exist.
public abstract <T> BeanletFactory<? extends T> getBeanletFactory(String beanletName,
Class<T> requiredType)
throws BeanletNotFoundException,
BeanletNotOfRequiredTypeException
Returns a BeanletFactory for the specified beanletName.
If no beanlet exists for the specified beanletName a
BeanletNotFoundException is thrown. If the beanlet definition
type is either the same as, or a subclass of the specified
requiredType, a generified BeanletFactory is returned
with the requiredType as upper bound.
This method ignores the "&" prefix.
beanletName - name of the beanlet.requiredType - type to mached the beanlet type.
BeanletFactory for the specified beanletName.
BeanletNotFoundException - if beanlet does not exist.
BeanletNotOfRequiredTypeException - if beanlet's type
is not the same as, or a subtype of requiredType.public abstract boolean exists(String beanletName)
Returns true if a beanlet exists for the specified
beanletName.
This method ignores the "&" prefix.
beanletName - name of the beanlet.
true if beanlet exists, or false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||