Package org.jboss.as.ee.component
Class BasicComponentInstance
- java.lang.Object
-
- org.jboss.as.ee.component.BasicComponentInstance
-
- All Implemented Interfaces:
Serializable,ComponentInstance
public class BasicComponentInstance extends Object implements ComponentInstance
An abstract base component instance.- Author:
- David M. Lloyd
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ObjectINSTANCE_KEY
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasicComponentInstance(BasicComponent component, org.jboss.invocation.Interceptor preDestroyInterceptor, Map<Method,org.jboss.invocation.Interceptor> methodInterceptors)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Method>allowedMethods()Get the list of allowed methods for this component instance.voidconstructionFinished()voiddestroy()Destroy this component instance.ComponentgetComponent()Get the component associated with this instance.ObjectgetInstance()Get the actual object instance.ObjectgetInstanceData(Object key)Gets some data that was attached to this component instanceorg.jboss.invocation.InterceptorgetInterceptor(Method method)Get the instance interceptor (entry point) for the given method.protected voidpreDestroy()Method that sub classes can use to override destroy logic.protected org.jboss.invocation.InterceptorContextprepareInterceptorContext()voidsetInstanceData(Object key, Object value)Attaches some data to this component instance.
-
-
-
Field Detail
-
INSTANCE_KEY
public static final Object INSTANCE_KEY
-
-
Constructor Detail
-
BasicComponentInstance
protected BasicComponentInstance(BasicComponent component, org.jboss.invocation.Interceptor preDestroyInterceptor, Map<Method,org.jboss.invocation.Interceptor> methodInterceptors)
Construct a new instance.- Parameters:
component- the component
-
-
Method Detail
-
getComponent
public Component getComponent()
Get the component associated with this instance.- Specified by:
getComponentin interfaceComponentInstance- Returns:
- the component
-
getInstance
public Object getInstance()
Get the actual object instance. The object instance has all injections filled.- Specified by:
getInstancein interfaceComponentInstance- Returns:
- the instance
-
getInterceptor
public org.jboss.invocation.Interceptor getInterceptor(Method method) throws IllegalStateException
Get the instance interceptor (entry point) for the given method. This is the internal entry point for the component instance, which bypasses view interceptors.- Specified by:
getInterceptorin interfaceComponentInstance- Parameters:
method- the method- Returns:
- the interceptor
- Throws:
IllegalStateException- if the method does not exist
-
allowedMethods
public Collection<Method> allowedMethods()
Get the list of allowed methods for this component instance. The handler will only accept invocations on these exactMethodobjects.- Specified by:
allowedMethodsin interfaceComponentInstance- Returns:
- the list of methods
-
destroy
public final void destroy()
Destroy this component instance. Implementations of this method must be idempotent, meaning that destroying a component instance more than one time has no additional effect.- Specified by:
destroyin interfaceComponentInstance
-
getInstanceData
public Object getInstanceData(Object key)
Description copied from interface:ComponentInstanceGets some data that was attached to this component instance- Specified by:
getInstanceDatain interfaceComponentInstance- Parameters:
key- The component data key- Returns:
- The attached data
-
setInstanceData
public void setInstanceData(Object key, Object value)
Description copied from interface:ComponentInstanceAttaches some data to this component instance. This should only be used during component construction.- Specified by:
setInstanceDatain interfaceComponentInstance- Parameters:
key- The key to store the datavalue- The data value
-
constructionFinished
public void constructionFinished()
-
preDestroy
protected void preDestroy()
Method that sub classes can use to override destroy logic.
-
prepareInterceptorContext
protected org.jboss.invocation.InterceptorContext prepareInterceptorContext()
-
-