|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.weld.environment.se.Weld
public class Weld
The preferred method of booting Weld SE.
Typical usage of this API looks like this:
WeldContainer weld = new Weld().initialize(); weld.instance().select(Foo.class).get(); weld.event().select(Bar.class).fire(new Bar()); weld.shutdown();
Constructor Summary | |
---|---|
Weld()
|
Method Summary | ||
---|---|---|
void |
addExtension(javax.enterprise.inject.spi.Extension extension)
Add extension explicitly. |
|
protected org.jboss.weld.bootstrap.spi.Deployment |
createDeployment(org.jboss.weld.resources.spi.ResourceLoader resourceLoader,
org.jboss.weld.bootstrap.api.Bootstrap bootstrap)
Extensions to Weld SE can subclass and override this method to customise the deployment before weld boots up. |
|
protected
|
getInstanceByType(javax.enterprise.inject.spi.BeanManager manager,
Class<T> type,
Annotation... bindings)
Utility method allowing managed instances of beans to provide entry points for non-managed beans (such as WeldContainer ). |
|
WeldContainer |
initialize()
Boots Weld and creates and returns a WeldContainer instance, through which beans and events can be accessed. |
|
void |
shutdown()
Shuts down Weld. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Weld()
Method Detail |
---|
public void addExtension(javax.enterprise.inject.spi.Extension extension)
extension
- an extensionpublic WeldContainer initialize()
protected org.jboss.weld.bootstrap.spi.Deployment createDeployment(org.jboss.weld.resources.spi.ResourceLoader resourceLoader, org.jboss.weld.bootstrap.api.Bootstrap bootstrap)
Extensions to Weld SE can subclass and override this method to customise the deployment before weld boots up. For example, to add a custom ResourceLoader, you would subclass Weld like so:
public class MyWeld extends Weld { protected Deployment createDeployment() { Deployment deployment = super.createDeployment(); deployment.getServices().add(ResourceLoader.class, new MyResourceLoader()); return deployment; } }
This could then be used as normal:
WeldContainer container = new MyWeld().initialize();
protected <T> T getInstanceByType(javax.enterprise.inject.spi.BeanManager manager, Class<T> type, Annotation... bindings)
WeldContainer
). Should only called
once Weld has finished booting.
manager
- the BeanManager to use to access the managed instancetype
- the type of the Beanbindings
- the bean's qualifiers
IllegalArgumentException
- if the given type represents a type
variable
IllegalArgumentException
- if two instances of the same qualifier
type are given
IllegalArgumentException
- if an instance of an annotation that is
not a qualifier type is given
javax.enterprise.inject.UnsatisfiedResolutionException
- if no beans can be resolved * @throws
AmbiguousResolutionException if the ambiguous dependency
resolution rules fail
IllegalArgumentException
- if the given type is not a bean type of
the given beanpublic void shutdown()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |