Package org.infinispan.cdi.common.util
Class ImmutableBean<T>
java.lang.Object
org.infinispan.cdi.common.util.AbstractImmutableBean<T>
org.infinispan.cdi.common.util.ImmutableBean<T>
- All Implemented Interfaces:
Contextual<T>,Bean<T>,BeanAttributes<T>
- Direct Known Subclasses:
ImmutablePassivationCapableBean
A base class for implementing Bean. The attributes are immutable, and
collections are defensively copied on instantiation. It uses the defaults
from the specification for properties if not specified.
This bean delegates it's lifecycle to the callbacks on the provided
ContextualLifecycle.
- Author:
- Stuart Douglas, Pete Muir
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableBean(Class<?> beanClass, String name, Set<Annotation> qualifiers, Class<? extends Annotation> scope, Set<Class<? extends Annotation>> stereotypes, Set<Type> types, boolean alternative, boolean nullable, Set<InjectionPoint> injectionPoints, ContextualLifecycle<T> contextualLifecycle, String toString) Create a new, immutable bean. -
Method Summary
Modifier and TypeMethodDescriptioncreate(CreationalContext<T> arg0) Create a new instance of the contextual type.voiddestroy(T arg0, CreationalContext<T> arg1) Destroy an instance of the contextual type.Methods inherited from class org.infinispan.cdi.common.util.AbstractImmutableBean
getBeanClass, getInjectionPoints, getName, getQualifiers, getScope, getStereotypes, getTypes, isAlternative, isNullable, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jakarta.enterprise.inject.spi.Bean
getBeanClass, getInjectionPointsMethods inherited from interface jakarta.enterprise.inject.spi.BeanAttributes
getName, getQualifiers, getScope, getStereotypes, getTypes, isAlternative
-
Constructor Details
-
ImmutableBean
public ImmutableBean(Class<?> beanClass, String name, Set<Annotation> qualifiers, Class<? extends Annotation> scope, Set<Class<? extends Annotation>> stereotypes, Set<Type> types, boolean alternative, boolean nullable, Set<InjectionPoint> injectionPoints, ContextualLifecycle<T> contextualLifecycle, String toString) Create a new, immutable bean. All arguments passed as collections are defensively copied.- Parameters:
beanClass- The Bean class, may not be nullname- The bean namequalifiers- The bean's qualifiers, if null, a singleton set ofDefaultis usedscope- The bean's scope, if null, the default scope ofDependentis usedstereotypes- The bean's stereotypes, if null, an empty set is usedtypes- The bean's types, if null, the beanClass andObjectwill be usedalternative- True if the bean is an alternativenullable- True if the bean is nullableinjectionPoints- the bean's injection points, if null an empty set is usedcontextualLifecycle- Handler forcreate(CreationalContext)anddestroy(Object, CreationalContext)toString- the string representation of the bean, if null the built in representation is used, which states the bean class and qualifiers- Throws:
IllegalArgumentException- if the beanClass is null
-
-
Method Details
-
create
Description copied from interface:ContextualCreate a new instance of the contextual type. Instances should use the givenCreationalContextwhen obtaining contextual references to inject, in order to ensure that any dependent objects are associated with the contextual instance that is being created. An implementation may callCreationalContext.push(Object)between instantiation and injection to help the container minimize the use of client proxy objects.- Specified by:
createin interfaceContextual<T>- Parameters:
arg0- the context in which this instance is being created- Returns:
- the contextual instance
-
destroy
Description copied from interface:ContextualDestroy an instance of the contextual type. Implementations should callCreationalContext.release()to allow the container to destroy dependent objects of the contextual instance.- Specified by:
destroyin interfaceContextual<T>- Parameters:
arg0- the contextual instance to destroyarg1- the context in which this instance was created
-