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

java.lang.Object
  extended by com.caucho.config.inject.AbstractBean<T>
      extended by com.caucho.config.inject.BeanAdapter<T,T>
          extended by com.caucho.config.inject.BeanWrapper<T>
              extended by com.caucho.config.inject.AbstractSingletonBean<T>
All Implemented Interfaces:
AnnotatedBean, ObjectProxy, java.io.Closeable, Contextual<T>, Bean<T>, PassivationCapable
Direct Known Subclasses:
InjectionBean, ManagedSingletonBean, SingletonBean

public abstract class AbstractSingletonBean<T>
extends BeanWrapper<T>
implements java.io.Closeable, AnnotatedBean, PassivationCapable

SingletonBean represents a singleton instance exported as a web beans.


Method Summary
 void close()
          Frees the singleton on environment shutdown
abstract  T create(CreationalContext<T> env)
          Creates a new instance for the Contextual's type.
 Annotated getAnnotated()
           
 AnnotatedType<T> getAnnotatedType()
           
 java.lang.String getId()
          Return passivation id
 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.
 void introspectProduces()
           
 
Methods inherited from class com.caucho.config.inject.BeanWrapper
destroy
 
Methods inherited from class com.caucho.config.inject.BeanAdapter
getBean, getBeanClass, getInjectionPoints, isAlternative, isNullable
 
Methods inherited from class com.caucho.config.inject.AbstractBean
calculatePassivationId, createObject, getBeanManager, getInjectionTarget, getJavaClass, introspect, isPassivationCapable, toDisplayString, toDisplayStringImpl, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getAnnotated

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

getAnnotatedType

public AnnotatedType<T> getAnnotatedType()
Overrides:
getAnnotatedType 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 BeanAdapter<T,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 BeanAdapter<T,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 BeanAdapter<T,T>

getId

public java.lang.String getId()
Return passivation id

Specified by:
getId in interface PassivationCapable
Overrides:
getId in class AbstractBean<T>

introspectProduces

public void introspectProduces()

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 BeanAdapter<T,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>
Overrides:
getTypes in class BeanAdapter<T,T>

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>
Overrides:
create in class BeanWrapper<T>
Parameters:
env - the creation context used to support circular references.
Returns:
the new instance

close

public void close()
Frees the singleton on environment shutdown

Specified by:
close in interface java.io.Closeable