com.caucho.config.inject
Class BeanAdapter<X,T>

java.lang.Object
  extended by com.caucho.config.inject.AbstractBean<T>
      extended by com.caucho.config.inject.BeanAdapter<X,T>
All Implemented Interfaces:
AnnotatedBean, ObjectProxy, Contextual<T>, Bean<T>
Direct Known Subclasses:
BeanWrapper, SessionRegistrationBean

@Module
public abstract class BeanAdapter<X,T>
extends AbstractBean<T>

Adapter from an internal bean to an external exposed bean as used by session beans.


Constructor Summary
BeanAdapter(InjectManager manager, Bean<X> bean)
           
 
Method Summary
abstract  T create(CreationalContext<T> env)
          Creates a new instance for the Contextual's type.
abstract  void destroy(T instance, CreationalContext<T> env)
          Destroys an instance for the Contextual's type.
 Annotated getAnnotated()
           
protected  Bean<X> getBean()
           
 java.lang.Class<?> getBeanClass()
          Returns the bean class.
 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 qualifier annotations.
 java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
          Returns the bean's scope type.
 java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getStereotypes()
          Returns the stereotypes that the bean uses for priority
 java.util.Set<java.lang.reflect.Type> getTypes()
          Returns the types that the bean exports for bindings.
 boolean isAlternative()
          True for a disabled alternative.
 boolean isNullable()
          Returns true if the bean can be null
 
Methods inherited from class com.caucho.config.inject.AbstractBean
calculatePassivationId, createObject, getAnnotatedType, getBeanManager, getId, getInjectionTarget, getJavaClass, introspect, isPassivationCapable, toDisplayString, toDisplayStringImpl, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanAdapter

public BeanAdapter(InjectManager manager,
                   Bean<X> bean)
Method Detail

getBean

protected Bean<X> getBean()

create

public abstract T create(CreationalContext<T> env)
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>
Specified by:
create in class AbstractBean<T>
Parameters:
env - the creation context used to support circular references.
Returns:
the new instance

destroy

public abstract void destroy(T instance,
                             CreationalContext<T> env)
Description copied from interface: Contextual
Destroys an instance for the Contextual's type.
  1. Call any @Disposal method
  2. Call @PreDestroy methods
  3. Destroy dependent objects

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

getAnnotated

public Annotated getAnnotated()
Specified by:
getAnnotated in interface AnnotatedBean
Overrides:
getAnnotated in class AbstractBean<T>

getQualifiers

public java.util.Set<java.lang.annotation.Annotation> getQualifiers()
Description copied from interface: Bean
Returns the bean's qualifier annotations.

Specified by:
getQualifiers in interface Bean<T>
Overrides:
getQualifiers in class AbstractBean<T>

getStereotypes

public java.util.Set<java.lang.Class<? extends java.lang.annotation.Annotation>> getStereotypes()
Description copied from interface: Bean
Returns the stereotypes that the bean uses for priority

Specified by:
getStereotypes in interface Bean<T>
Overrides:
getStereotypes in class AbstractBean<T>

getInjectionPoints

public java.util.Set<InjectionPoint> getInjectionPoints()
Description copied from interface: Bean
Returns the set of injection points, for validation.

Specified by:
getInjectionPoints in interface Bean<T>
Overrides:
getInjectionPoints in class AbstractBean<T>

getName

public java.lang.String getName()
Description copied from interface: Bean
Returns the bean's name or null if the bean does not have a primary name.

Specified by:
getName in interface Bean<T>
Overrides:
getName in class AbstractBean<T>

isAlternative

public boolean isAlternative()
Description copied from interface: Bean
True for a disabled alternative.

Specified by:
isAlternative in interface Bean<T>
Overrides:
isAlternative in class AbstractBean<T>

isNullable

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

Specified by:
isNullable in interface Bean<T>
Overrides:
isNullable in class AbstractBean<T>

getScope

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

Specified by:
getScope in interface Bean<T>
Overrides:
getScope in class AbstractBean<T>

getTypes

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

Specified by:
getTypes in interface Bean<T>
Specified by:
getTypes in class AbstractBean<T>

getBeanClass

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

Specified by:
getBeanClass in interface Bean<T>
Overrides:
getBeanClass in class AbstractBean<T>