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, AbstractProducerBean, DisposalMethodBean

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  java.util.Set<java.lang.annotation.Annotation> bindings
           
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<? extends java.lang.reflect.Type> types
           
 
Constructor Summary
AbstractBean(ManagerImpl manager)
          Constructor
 
Method Summary
protected  void checkDeploymentType()
          Validates the deployment type
protected  void checkRequiredTypesImplemented()
          Validates that the required types are implemented
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
 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, java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> 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()
          The injection points of a bean
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<? extends java.lang.reflect.Type> getTypes()
          Gets the API types of the bean
protected  void initBindings()
          Initializes the binding types
protected  void initDefaultBindings()
           
protected abstract  void initDeploymentType()
          Initializes the deployment types
protected  void initDeploymentTypeFromStereotype()
           
 void initialize(BeanDeployerEnvironment environment)
          Initializes the bean and its metadata
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 initTypes()
          Initializes the API types
 boolean isAssignableFrom(AnnotatedItem<?,?> annotatedItem)
          Checks if this beans annotated item is assignable from another annotated item
 boolean isDependent()
           
protected  boolean isInitialized()
           
 boolean isNullable()
          Indicates if bean is nullable
 boolean isPrimitive()
          Indicates if bean type is a primitive
 boolean isProxyable()
           
 boolean isSerializable()
          The serializability of a bean
 boolean isSpecializing()
           
protected  void postSpecialize()
           
protected  void preSpecialize(BeanDeployerEnvironment environment)
           
protected  void specialize(BeanDeployerEnvironment environment)
           
 java.lang.String toString()
          Gets a string representation
 
Methods inherited from class org.jboss.webbeans.bean.RIBean
createId, equals, getId, getManager, hashCode
 
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 final DependentInstancesStore dependentInstancesStore

bindings

protected java.util.Set<java.lang.annotation.Annotation> bindings

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<? extends 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,
                                                                                           java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> 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

isInitialized

protected boolean isInitialized()

initialize

public void initialize(BeanDeployerEnvironment environment)
Initializes the bean and its metadata

Specified by:
initialize in class RIBean<T>

initTypes

protected void initTypes()
Initializes the API types


initBindings

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


initScopeType

protected abstract void initScopeType()
Initializes the scope type


initScopeTypeFromStereotype

protected boolean initScopeTypeFromStereotype()

checkDeploymentType

protected void checkDeploymentType()
Validates the deployment type


checkRequiredTypesImplemented

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


postSpecialize

protected void postSpecialize()

preSpecialize

protected void preSpecialize(BeanDeployerEnvironment environment)

specialize

protected void specialize(BeanDeployerEnvironment environment)

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()
Description copied from class: Bean
The injection points of a bean

Specified by:
getInjectionPoints in class RIBean<T>
Returns:
the injection points of a bean

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<? extends 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()
Description copied from class: Bean
The serializability of a bean

Specified by:
isSerializable in class Bean<T>
Returns:
true if the bean is serializable

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>

isDependent

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

isSpecializing

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


Copyright © 2011. All Rights Reserved.