org.jboss.webbeans.bean
Class AbstractBean<T,E>

java.lang.Object
  extended by javax.webbeans.manager.Bean<T>
      extended by org.jboss.webbeans.bean.AbstractBean<T,E>
Type Parameters:
T -
E -
All Implemented Interfaces:
Contextual<T>
Direct Known Subclasses:
AbstractClassBean, AbstractFacadeBean, AbstractProducerBean

public abstract class AbstractBean<T,E>
extends Bean<T>

An abstract bean representation common for all beans

Author:
Pete Muir

Field Summary
protected  java.util.Set<java.lang.Class<?>> apiTypes
           
protected  java.lang.Class<? extends java.lang.annotation.Annotation> deploymentType
           
protected  java.util.Set<AnnotatedItem<?,?>> injectionPoints
           
protected  ManagerImpl manager
           
protected  java.lang.String name
           
protected  java.lang.Class<? extends java.lang.annotation.Annotation> scopeType
           
protected  java.lang.Class<T> type
           
 
Constructor Summary
AbstractBean(ManagerImpl manager)
          Constructor
 
Method Summary
protected  void bindDecorators()
          Binds the decorators to the proxy
protected  void bindInterceptors()
          Binds the interceptors to the proxy
protected  void checkDeploymentType()
          Validates the deployment type
protected abstract  AnnotatedItem<T,E> getAnnotatedItem()
          Returns the annotated time the bean represents
 java.util.Set<java.lang.annotation.Annotation> getBindingTypes()
          Gets the binding types
protected  java.lang.reflect.Type getDeclaredBeanType()
          Gets the declared bean type
protected abstract  java.lang.Class<? extends java.lang.annotation.Annotation> getDefaultDeploymentType()
          Gets the default deployment type
protected abstract  java.lang.String getDefaultName()
          Gets the default name of the bean
 java.lang.Class<? extends java.lang.annotation.Annotation> getDeploymentType()
          Gets the deployment type of the bean
static java.lang.Class<? extends java.lang.annotation.Annotation> getDeploymentType(java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> enabledDeploymentTypes, AbstractAnnotatedItem.AnnotationMap possibleDeploymentTypes)
          Helper class for getting deployment type Loops through the enabled deployment types (backwards) and returns the first one present in the possible deployments type, resulting in the deployment type of highest priority
 java.util.Set<AnnotatedItem<?,?>> getInjectionPoints()
          Gets the injection points of the bean
 MergedStereotypes<T,E> getMergedStereotypes()
          Gets the merged stereotypes of the bean
 java.lang.String getName()
          Gets the name of the bean
 java.lang.Class<? extends java.lang.annotation.Annotation> getScopeType()
          Gets the scope type of the bean
protected  AbstractBean<? extends T,E> getSpecializedType()
          Gets the specializes type of the bean
 java.lang.Class<T> getType()
          Gets the type of the bean
 java.util.Set<java.lang.Class<?>> getTypes()
          Gets the API types of the bean
protected  void init()
          Initializes the bean and its metadata
protected  void initApiTypes()
          Initializes the API types
protected  void initBindingTypes()
          Initializes the binding types
protected  void initDeploymentType()
          Initializes the deployment types
protected  void initInjectionPoints()
          Initializes the injection points
protected  void initName()
          Initializes the name
protected  void initPrimitive()
          Initializes the primitive flag
protected  void initScopeType()
          Initializes the scope type
protected abstract  void initType()
          Initializes the type of the bean
 boolean isAssignableFrom(AnnotatedItem<?,?> annotatedItem)
          Checks if this beans annotated item is assignable from another annotated item
 boolean isNullable()
          Indicates if bean is nullable
 boolean isPrimitive()
          Indicates if bean type is a primitive
 boolean isSerializable()
          Indicates if bean is serializable
 java.lang.String toDetailedString()
           
 java.lang.String toString()
          Gets a string representation
 
Methods inherited from class javax.webbeans.manager.Bean
create, destroy, getManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

scopeType

protected java.lang.Class<? extends java.lang.annotation.Annotation> scopeType

deploymentType

protected java.lang.Class<? extends java.lang.annotation.Annotation> deploymentType

type

protected java.lang.Class<T> type

apiTypes

protected java.util.Set<java.lang.Class<?>> apiTypes

injectionPoints

protected java.util.Set<AnnotatedItem<?,?>> injectionPoints

manager

protected ManagerImpl manager
Constructor Detail

AbstractBean

public AbstractBean(ManagerImpl manager)
Constructor

Parameters:
manager - The Web Beans manager
Method Detail

getDeploymentType

public static java.lang.Class<? extends java.lang.annotation.Annotation> getDeploymentType(java.util.List<java.lang.Class<? extends java.lang.annotation.Annotation>> enabledDeploymentTypes,
                                                                                           AbstractAnnotatedItem.AnnotationMap possibleDeploymentTypes)
Helper class for getting deployment type Loops through the enabled deployment types (backwards) and returns the first one present in the possible deployments type, resulting in the deployment type of highest priority

Parameters:
enabledDeploymentTypes - The currently enabled deployment types
possibleDeploymentTypes - The possible deployment types
Returns:
The deployment type

init

protected void init()
Initializes the bean and its metadata


initApiTypes

protected void initApiTypes()
Initializes the API types


initBindingTypes

protected void initBindingTypes()
Initializes the binding types


initDeploymentType

protected void initDeploymentType()
Initializes the deployment types


getDefaultDeploymentType

protected abstract java.lang.Class<? extends java.lang.annotation.Annotation> getDefaultDeploymentType()
Gets the default deployment type

Returns:
The default deployment type

initInjectionPoints

protected void initInjectionPoints()
Initializes the injection points


initName

protected void initName()
Initializes the name


initPrimitive

protected void initPrimitive()
Initializes the primitive flag


initScopeType

protected void initScopeType()
Initializes the scope type


initType

protected abstract void initType()
Initializes the type of the bean


checkDeploymentType

protected void checkDeploymentType()
Validates the deployment type


bindDecorators

protected void bindDecorators()
Binds the decorators to the proxy


bindInterceptors

protected void bindInterceptors()
Binds the interceptors to the proxy


getAnnotatedItem

protected abstract AnnotatedItem<T,E> getAnnotatedItem()
Returns the annotated time the bean represents

Returns:
The annotated item

getBindingTypes

public java.util.Set<java.lang.annotation.Annotation> getBindingTypes()
Gets the binding types

Specified by:
getBindingTypes in class Bean<T>
Returns:
The set of binding types
See Also:
Bean.getBindingTypes()

getDeclaredBeanType

protected java.lang.reflect.Type getDeclaredBeanType()
Gets the declared bean type

Returns:
The bean type

getDefaultName

protected abstract java.lang.String getDefaultName()
Gets the default name of the bean

Returns:
The default name

getDeploymentType

public java.lang.Class<? extends java.lang.annotation.Annotation> getDeploymentType()
Gets the deployment type of the bean

Specified by:
getDeploymentType in class Bean<T>
Returns:
The deployment type
See Also:
Bean.getDeploymentType()

getInjectionPoints

public java.util.Set<AnnotatedItem<?,?>> getInjectionPoints()
Gets the injection points of the bean

Returns:
The set of injection points

getMergedStereotypes

public MergedStereotypes<T,E> getMergedStereotypes()
Gets the merged stereotypes of the bean

Returns:
The set of merged stereotypes

getName

public java.lang.String getName()
Gets the name of the bean

Specified by:
getName in class Bean<T>
Returns:
The name
See Also:
Bean.getName()

getScopeType

public java.lang.Class<? extends java.lang.annotation.Annotation> getScopeType()
Gets the scope type of the bean

Specified by:
getScopeType in class Bean<T>
Returns:
The scope type
See Also:
Bean.getScopeType()

getSpecializedType

protected AbstractBean<? extends T,E> getSpecializedType()
Gets the specializes type of the bean

Returns:
The specialized type

getType

public java.lang.Class<T> getType()
Gets the type of the bean

Returns:
The type

getTypes

public java.util.Set<java.lang.Class<?>> getTypes()
Gets the API types of the bean

Specified by:
getTypes in class Bean<T>
Returns:
The set of API types
See Also:
Bean.getTypes()

isAssignableFrom

public boolean isAssignableFrom(AnnotatedItem<?,?> annotatedItem)
Checks if this beans annotated item is assignable from another annotated item

Parameters:
annotatedItem - The other annotation to check
Returns:
True if assignable, otherwise false

isNullable

public boolean isNullable()
Indicates if bean is nullable

Specified by:
isNullable in class Bean<T>
Returns:
True if nullable, false otherwise
See Also:
Bean.isNullable()

isPrimitive

public boolean isPrimitive()
Indicates if bean type is a primitive

Returns:
True if primitive, false otherwise

isSerializable

public boolean isSerializable()
Indicates if bean is serializable

Specified by:
isSerializable in class Bean<T>
Returns:
True if serializable, false otherwise
See Also:
javax.webbeans.manager.Bean#isSerializable()

toString

public java.lang.String toString()
Gets a string representation

Overrides:
toString in class java.lang.Object
Returns:
The string representation

toDetailedString

public java.lang.String toDetailedString()


Copyright © 2008. All Rights Reserved.