com.caucho.config.inject
Class DecoratorBean<T>

java.lang.Object
  extended by com.caucho.config.inject.DecoratorBean<T>
All Implemented Interfaces:
Contextual<T>, Bean<T>, Decorator<T>

@Module
public class DecoratorBean<T>
extends java.lang.Object
implements Decorator<T>

DecoratorBean represents a Java decorator


Constructor Summary
DecoratorBean(InjectManager beanManager, java.lang.Class<T> type)
           
 
Method Summary
 void bind()
           
 T create(CreationalContext<T> creationalContext)
          Creates a new instance for the Contextual's type.
 void destroy(T instance, CreationalContext<T> env)
          Call destroy
 java.lang.Class<?> getBeanClass()
          Returns the bean class.
 java.util.Set<java.lang.reflect.Type> getDecoratedTypes()
          Returns the types for the decorated
 InjectionPoint getDelegateInjectionPoint()
           
 java.util.Set<java.lang.annotation.Annotation> getDelegateQualifiers()
          Returns the bindings for the delegated object
 java.lang.reflect.Type getDelegateType()
          Returns the type of the delegated object
 java.util.Set<InjectionPoint> getInjectionPoints()
          Returns the set of injection points, for validation.
 java.lang.String getName()
          Returns the bean's name or null if the bean does not have a primary name.
 java.util.Set<java.lang.annotation.Annotation> getQualifiers()
          Returns the bean's binding types
 java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
          Returns the bean's scope
 java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getStereotypes()
          Returns the bean's deployment type
 java.util.Set<java.lang.reflect.Type> getTypes()
          Returns the types that the bean implements
 T instantiate()
          Instantiate the bean.
protected  void introspect()
           
protected  void introspectBindingTypes(java.lang.annotation.Annotation[] annList)
           
 boolean isAlternative()
          Returns true if the bean can be null
 boolean isNullable()
          Returns true if the bean can be null
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DecoratorBean

public DecoratorBean(InjectManager beanManager,
                     java.lang.Class<T> type)
Method Detail

getQualifiers

public java.util.Set<java.lang.annotation.Annotation> getQualifiers()
Returns the bean's binding types

Specified by:
getQualifiers in interface Bean<T>

getStereotypes

public java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getStereotypes()
Returns the bean's deployment type

Specified by:
getStereotypes in interface Bean<T>

getName

public java.lang.String getName()
Returns the bean's name or null if the bean does not have a primary name.

Specified by:
getName in interface Bean<T>

isNullable

public boolean isNullable()
Returns true if the bean can be null

Specified by:
isNullable in interface Bean<T>

isAlternative

public boolean isAlternative()
Returns true if the bean can be null

Specified by:
isAlternative in interface Bean<T>

getScope

public java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
Returns the bean's scope

Specified by:
getScope in interface Bean<T>

getTypes

public java.util.Set<java.lang.reflect.Type> getTypes()
Returns the types that the bean implements

Specified by:
getTypes in interface Bean<T>

getDecoratedTypes

public java.util.Set<java.lang.reflect.Type> getDecoratedTypes()
Returns the types for the decorated

Specified by:
getDecoratedTypes in interface Decorator<T>

create

public T create(CreationalContext<T> creationalContext)
Description copied from interface: Contextual
Creates a new instance for the Contextual's type. If the instance already exists in the CreationalContext, create will return it instead of creating a new instance.
  1. create an instance of the bean
  2. create interceptor and decorator stacks
  3. inject dependencies
  4. set any XML-configured values
  5. call @PostConstruct

Specified by:
create in interface Contextual<T>
Parameters:
creationalContext - the creation context used to support circular references.
Returns:
the new instance

getInjectionPoints

public java.util.Set<InjectionPoint> getInjectionPoints()
Returns the set of injection points, for validation.

Specified by:
getInjectionPoints in interface Bean<T>

getBeanClass

public java.lang.Class<?> getBeanClass()
Description copied from interface: Bean
Returns the bean class.

Specified by:
getBeanClass in interface Bean<T>

getDelegateType

public java.lang.reflect.Type getDelegateType()
Returns the type of the delegated object

Specified by:
getDelegateType in interface Decorator<T>

getDelegateQualifiers

public java.util.Set<java.lang.annotation.Annotation> getDelegateQualifiers()
Returns the bindings for the delegated object

Specified by:
getDelegateQualifiers in interface Decorator<T>

getDelegateInjectionPoint

public InjectionPoint getDelegateInjectionPoint()

bind

public void bind()

introspect

protected void introspect()

introspectBindingTypes

protected void introspectBindingTypes(java.lang.annotation.Annotation[] annList)

instantiate

public T instantiate()
Instantiate the bean.


destroy

public void destroy(T instance,
                    CreationalContext<T> env)
Call destroy

Specified by:
destroy in interface Contextual<T>
Parameters:
instance - the instance to destroy

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object