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

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

public abstract class AbstractBean<T>
extends java.lang.Object
implements Bean<T>, ObjectProxy, AnnotatedBean

Common bean introspection for Produces and ManagedBean.


Constructor Summary
AbstractBean(InjectManager beanManager)
           
 
Method Summary
protected  java.lang.String calculatePassivationId()
           
abstract  T create(CreationalContext<T> creationalContext)
          Creates a new instance for the Contextual's type.
 java.lang.Object createObject(java.util.Hashtable env)
          Creates the object from the proxy.
 void destroy(T instance, CreationalContext<T> env)
          Destroys an instance for the Contextual's type.
 Annotated getAnnotated()
           
 AnnotatedType<T> getAnnotatedType()
           
 java.lang.Class<?> getBeanClass()
          Returns the bean class.
 InjectManager getBeanManager()
           
 java.lang.String getId()
           
 java.util.Set<InjectionPoint> getInjectionPoints()
          Returns the set of injection points, for validation.
 InjectionTarget<T> getInjectionTarget()
           
 java.lang.Class<?> getJavaClass()
           
 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
abstract  java.util.Set<java.lang.reflect.Type> getTypes()
          Returns the types that the bean exports for bindings.
 void introspect()
           
 boolean isAlternative()
          True for a disabled alternative.
 boolean isNullable()
          Returns true if the bean can be null
 boolean isPassivationCapable()
           
 java.lang.String toDisplayString()
           
protected  java.lang.String toDisplayStringImpl()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractBean

public AbstractBean(InjectManager beanManager)
Method Detail

getBeanManager

public InjectManager getBeanManager()

getId

public java.lang.String getId()

getAnnotated

public Annotated getAnnotated()
Specified by:
getAnnotated in interface AnnotatedBean

getAnnotatedType

public AnnotatedType<T> getAnnotatedType()

getInjectionTarget

public InjectionTarget<T> getInjectionTarget()

introspect

public void introspect()

create

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

destroy

public 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>
Parameters:
instance - the instance to destroy

getTypes

public abstract java.util.Set<java.lang.reflect.Type> getTypes()
Description copied from interface: Bean
Returns the types that the bean exports for bindings.

Specified by:
getTypes 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>

getJavaClass

public java.lang.Class<?> getJavaClass()

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>

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>

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>

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>

isAlternative

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

Specified by:
isAlternative in interface Bean<T>

isNullable

public boolean isNullable()
Description copied from interface: Bean
Returns true if the bean can be null

Specified by:
isNullable in interface Bean<T>

isPassivationCapable

public boolean isPassivationCapable()

getScope

public java.lang.Class<? extends java.lang.annotation.Annotation> getScope()
Description copied from interface: Bean
Returns the bean's scope type.

Specified by:
getScope in interface Bean<T>

calculatePassivationId

protected java.lang.String calculatePassivationId()

createObject

public java.lang.Object createObject(java.util.Hashtable env)
Creates the object from the proxy.

Specified by:
createObject in interface ObjectProxy
Returns:
the object named by the proxy.

toDisplayString

public java.lang.String toDisplayString()

toDisplayStringImpl

protected java.lang.String toDisplayStringImpl()

toString

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