Errai 3.0.1-SNAPSHOT

org.jboss.errai.ioc.rebind.ioc.extension
Class IOCDecoratorExtension<T extends Annotation>

java.lang.Object
  extended by org.jboss.errai.ioc.rebind.ioc.extension.IOCDecoratorExtension<T>
Type Parameters:
T -
Direct Known Subclasses:
AfterInitializationExtension, BoundDecorator, DataFieldCodeDecorator, ModelSetterDecorator, ObservesExtension, PageSecurityCodeDecorator, ServiceCodeDecorator, ShadowServiceIOCExtension, StyleBindingCodeDecorator, SyncDecorator, TemplatedCodeDecorator, TimedExtension, UncaughtExceptionDecorator

public abstract class IOCDecoratorExtension<T extends Annotation>
extends Object

A code decorator extension for the Errai IOC framework. Decorators allow the generation of code in and around annotated bean elements.

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.

Author:
Mike Brock

Constructor Summary
protected IOCDecoratorExtension(Class<T> decoratesWith)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOCDecoratorExtension

protected IOCDecoratorExtension(Class<T> decoratesWith)
Method Detail

decoratesWith

public Class<T> decoratesWith()

generateDecorator

public 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.

Parameters:
ctx - the InjectableInstance reference, representing the value of the element which is annotated.
Returns:
a list of statements to be rendered into the injector code.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.