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 Object
INSTANCE_KEY
-
Constructor Summary
Constructors Modifier Constructor Description protected
BasicComponentInstance(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.void
constructionFinished()
void
destroy()
Destroy this component instance.Component
getComponent()
Get the component associated with this instance.Object
getInstance()
Get the actual object instance.Object
getInstanceData(Object key)
Gets some data that was attached to this component instanceorg.jboss.invocation.Interceptor
getInterceptor(Method method)
Get the instance interceptor (entry point) for the given method.protected void
preDestroy()
Method that sub classes can use to override destroy logic.protected org.jboss.invocation.InterceptorContext
prepareInterceptorContext()
void
setInstanceData(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:
getComponent
in interfaceComponentInstance
- Returns:
- the component
-
getInstance
public Object getInstance()
Get the actual object instance. The object instance has all injections filled.- Specified by:
getInstance
in 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:
getInterceptor
in 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 exactMethod
objects.- Specified by:
allowedMethods
in 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:
destroy
in interfaceComponentInstance
-
getInstanceData
public Object getInstanceData(Object key)
Description copied from interface:ComponentInstance
Gets some data that was attached to this component instance- Specified by:
getInstanceData
in interfaceComponentInstance
- Parameters:
key
- The component data key- Returns:
- The attached data
-
setInstanceData
public void setInstanceData(Object key, Object value)
Description copied from interface:ComponentInstance
Attaches some data to this component instance. This should only be used during component construction.- Specified by:
setInstanceData
in 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()
-
-