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

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

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

An abstract bean representation common for all beans

Author:
Pete Muir

Field Summary
protected  boolean _serializable
           
protected  DependentInstancesStore dependentInstancesStore
           
protected  java.lang.Class<? extends java.lang.annotation.Annotation> deploymentType
           
protected  java.util.Set<AnnotatedInjectionPoint<?,?>> 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
           
protected  java.util.Set<java.lang.reflect.Type> types
           
 
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  boolean checkInjectionPointsAreSerializable()
           
protected  void checkRequiredTypesImplemented()
          Validates that the required types are implemented
 boolean equals(java.lang.Object other)
           
protected abstract  AnnotatedItem<T,E> getAnnotatedItem()
          Returns the annotated time the bean represents
 java.util.Set<java.lang.annotation.Annotation> getBindings()
          Gets the binding types
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
 DependentInstancesStore getDependentInstancesStore()
           
 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, AnnotationStore.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<AnnotatedInjectionPoint<?,?>> getInjectionPoints()
           
protected  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
abstract  AbstractBean<?,?> getSpecializedBean()
           
 java.lang.Class<T> getType()
          Gets the type of the bean
 java.util.Set<java.lang.reflect.Type> getTypes()
          Gets the API types of the bean
 int hashCode()
           
protected  void init()
          Initializes the bean and its metadata
protected  void initBindingTypes()
          Initializes the binding types
protected  void initDefaultBindings()
           
protected abstract  void initDeploymentType()
          Initializes the deployment types
protected  void initDeploymentTypeFromStereotype()
           
protected  void initName()
          Initializes the name
protected  void initPrimitive()
          Initializes the primitive flag
protected  void initProxyable()
           
protected abstract  void initScopeType()
          Initializes the scope type
protected  boolean initScopeTypeFromStereotype()
           
protected  void initSerializable()
           
protected  void initSpecialization()
           
protected abstract  void initType()
          Initializes the type of the bean
protected  void initTypes()
          Initializes the API types
 boolean isAssignableFrom(AnnotatedItem<?,?> annotatedItem)
          Checks if this beans annotated item is assignable from another annotated item
 boolean isDependent()
           
 boolean isNullable()
          Indicates if bean is nullable
 boolean isPrimitive()
          Indicates if bean type is a primitive
 boolean isProxyable()
           
 boolean isSerializable()
           
 boolean isSpecializing()
           
protected  void postSpecialization()
           
protected  void preCheckSpecialization()
           
 java.lang.String toString()
          Gets a string representation
 
Methods inherited from class org.jboss.webbeans.bean.RIBean
getManager
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.context.Contextual
create, destroy
 

Field Detail

dependentInstancesStore

protected DependentInstancesStore dependentInstancesStore

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

types

protected java.util.Set<java.lang.reflect.Type> types

injectionPoints

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

manager

protected ManagerImpl manager

_serializable

protected boolean _serializable
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,
                                                                                           AnnotationStore.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


initTypes

protected void initTypes()
Initializes the API types


initBindingTypes

protected void initBindingTypes()
Initializes the binding types


initDefaultBindings

protected void initDefaultBindings()

initDeploymentType

protected abstract void initDeploymentType()
Initializes the deployment types


initDeploymentTypeFromStereotype

protected void initDeploymentTypeFromStereotype()

getDefaultDeploymentType

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

Returns:
The default deployment type

initName

protected void initName()
Initializes the name


initProxyable

protected void initProxyable()

initPrimitive

protected void initPrimitive()
Initializes the primitive flag


checkInjectionPointsAreSerializable

protected boolean checkInjectionPointsAreSerializable()

initScopeType

protected abstract void initScopeType()
Initializes the scope type


initScopeTypeFromStereotype

protected boolean initScopeTypeFromStereotype()

initType

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


checkDeploymentType

protected void checkDeploymentType()
Validates the deployment type


checkRequiredTypesImplemented

protected void checkRequiredTypesImplemented()
Validates that the required types are implemented


postSpecialization

protected void postSpecialization()

preCheckSpecialization

protected void preCheckSpecialization()

initSpecialization

protected void initSpecialization()

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

getBindings

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

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

getDefaultName

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

Returns:
The default name

getSpecializedBean

public abstract AbstractBean<?,?> getSpecializedBean()
Specified by:
getSpecializedBean in class RIBean<T>

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<AnnotatedInjectionPoint<?,?>> getInjectionPoints()
Specified by:
getInjectionPoints in class RIBean<T>

getMergedStereotypes

protected 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()

getType

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

Specified by:
getType in class RIBean<T>
Returns:
The type

getTypes

public java.util.Set<java.lang.reflect.Type> 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

Specified by:
isPrimitive in class RIBean<T>
Returns:
True if primitive, false otherwise

isSerializable

public boolean isSerializable()
Specified by:
isSerializable in class Bean<T>

initSerializable

protected void initSerializable()

toString

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

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

isProxyable

public boolean isProxyable()
Specified by:
isProxyable in class RIBean<T>

getDependentInstancesStore

public DependentInstancesStore getDependentInstancesStore()

isDependent

public boolean isDependent()
Overrides:
isDependent in class RIBean<T>

isSpecializing

public boolean isSpecializing()
Specified by:
isSpecializing in class RIBean<T>

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2008-2009. All Rights Reserved.