|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BeanletReference<T>
Represents a reference to a beanlet.
Beanlets references are used to uniquely identify the underlying beanlet and to control the lifecycle of the beanlet.
Invocations made on a beanlet proxy that points to a stateful beanlet are always performed on the same beanlet instance. In case of a stateless beanlet, it is not specified which beanlet instance is used to execute the invocation.
Beanlet references can be removed, either explicitly by calling
invalidate() or alternatively, once it is no longer stronly reachable,
by the garbage collector. Beanlet references that have been removed can no
longer be used to perform calls on the underlying beanlet. Such calls will
result in an unchecked exception thrown by the application container. The
isRemoved() method can be used to check whether a reference has
been removed.
| Method Summary | |
|---|---|
Object |
execute(Event event)
Executes the specified event. |
Object |
getBeanlet()
Returns the beanlet. |
BeanletMetaData<T> |
getBeanletMetaData()
Returns meta data for the underlying beanlet. |
T |
getTypedBeanlet()
Returns the beanlet if this object is an instance of the beanlet type as specified by BeanletMetaData.getType(). |
void |
invalidate()
Causes this reference to be invalidated and removed. |
boolean |
isExecutable(Event event)
Returns true if specified event is supported by this
reference. |
boolean |
isRemoved()
Returns true if this reference has been removed, it
can no longer execute events, false otherwise. |
boolean |
isValid()
Returns true if this reference if valid. |
void |
remove()
Remove the reference immediately. |
| Method Detail |
|---|
BeanletMetaData<T> getBeanletMetaData()
Object getBeanlet()
T getTypedBeanlet()
throws BeanletNotOfRequiredTypeException
BeanletMetaData.getType(). This might not always
be the case, for example for proxy beanlets. In this case a
BeanletNotOfRequiredTypeException exception is thrown.
BeanletNotOfRequiredTypeException - if beanlet is not an instance
of beanlet type.boolean isExecutable(Event event)
true if specified event is supported by this
reference.
Object execute(Event event)
throws BeanletEventException
event.
BeanletEventException - result of event execution.void invalidate()
isValid returns false. Events can still be executed
while the reference is being invalidated.
This method is idempotent.
boolean isValid()
true if this reference if valid. If false is
returned, the reference is being destroyed and finally removed, resulting
in isRemoved to return true.
true if this reference is valid, false otherwise.void remove()
boolean isRemoved()
true if this reference has been removed, it
can no longer execute events, false otherwise.
true if this reference is removed, false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||