T
- public abstract class IOCDecoratorExtension<T extends Annotation> extends Object
For example, it may be desirable to register the instance of a newly created bean with a specific API as part of the bootstrapping code. A decorator makes this possible by making the IOC container's code generator reach out to a registered decorator associated with the specified annotation and providing the decorator an opportunity to return it's own generated code associated wth the instance value.
Decorators can be registered for any element type (classes, methods, constructors, fields, and parameters). And the type of element is automatically inferred by the element types which the registered annotation apply to.
Errai's own built in support for facilities such as @Service and @Observes implement their functionality as decorators.
Modifier | Constructor and Description |
---|---|
protected |
IOCDecoratorExtension(Class<T> decoratesWith) |
Modifier and Type | Method and Description |
---|---|
Class<T> |
decoratesWith() |
abstract List<? extends Statement> |
generateDecorator(InjectableInstance<T> ctx)
The generateDecorator() method is called at the point the container has finished constructing a
reference to an element annotated with the configured annotation.
|
public abstract List<? extends Statement> generateDecorator(InjectableInstance<T> ctx)
ctx
- the InjectableInstance
reference, representing
the value of the element which is annotated.Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.