Package jadex.commons.future
Class DelegationResultListener<E>
- java.lang.Object
-
- jadex.commons.future.DelegationResultListener<E>
-
- All Implemented Interfaces:
IFunctionalExceptionListener
,IFunctionalResultListener<E>
,IFutureCommandResultListener<E>
,IResultListener<E>
,IUndoneResultListener<E>
- Direct Known Subclasses:
DecouplingInterceptor.CopyReturnValueResultListener
,PrePostConditionInterceptor.CheckReturnValueResultListener
,TerminableDelegationResultListener
,TracingInterceptor.ReturnValueResultListener
public class DelegationResultListener<E> extends java.lang.Object implements IResultListener<E>, IFutureCommandResultListener<E>, IUndoneResultListener<E>
Result listener that delegates calls to a future.
-
-
Field Summary
Fields Modifier and Type Field Description protected IFunctionalResultListener<E>
customResultListener
Custom functional result listenerprotected Future<E>
future
The future to which calls are delegated.protected boolean
undone
Flag if undone methods should be used.
-
Constructor Summary
Constructors Constructor Description DelegationResultListener(Future<E> future)
Create a new listener.DelegationResultListener(Future<E> future, boolean undone)
Create a new listener.DelegationResultListener(Future<E> future, boolean undone, IFunctionalResultListener<E> customResultListener)
Create a new listener.DelegationResultListener(Future<E> future, IFunctionalResultListener<E> customResultListener)
Create a new listener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commandAvailable(java.lang.Object command)
Called when a command is available.void
customResultAvailable(E result)
Called when the result is available.void
exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.void
exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.boolean
isUndone()
Get the undone.void
resultAvailable(E result)
Called when the result is available.void
resultAvailableIfUndone(E result)
Called when the result is available.
-
-
-
Field Detail
-
undone
protected boolean undone
Flag if undone methods should be used.
-
customResultListener
protected IFunctionalResultListener<E> customResultListener
Custom functional result listener
-
-
Constructor Detail
-
DelegationResultListener
public DelegationResultListener(Future<E> future, IFunctionalResultListener<E> customResultListener)
Create a new listener.- Parameters:
future
- The delegation target.customResultListener
- Custom result listener that overwrites the delegation behaviour.
-
DelegationResultListener
public DelegationResultListener(Future<E> future, boolean undone, IFunctionalResultListener<E> customResultListener)
Create a new listener.- Parameters:
future
- The delegation target.undone
- use undone methods.customResultListener
- Custom result listener that overwrites the delegation behaviour.
-
-
Method Detail
-
resultAvailable
public final void resultAvailable(E result)
Called when the result is available.- Specified by:
resultAvailable
in interfaceIFunctionalResultListener<E>
- Parameters:
result
- The result.
-
customResultAvailable
public void customResultAvailable(E result)
Called when the result is available.- Parameters:
result
- The result.
-
exceptionOccurred
public void exceptionOccurred(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurred
in interfaceIFunctionalExceptionListener
- Parameters:
exception
- The exception.
-
commandAvailable
public void commandAvailable(java.lang.Object command)
Called when a command is available.- Specified by:
commandAvailable
in interfaceIFutureCommandResultListener<E>
-
resultAvailableIfUndone
public void resultAvailableIfUndone(E result)
Called when the result is available.- Specified by:
resultAvailableIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
result
- The result.
-
exceptionOccurredIfUndone
public void exceptionOccurredIfUndone(java.lang.Exception exception)
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndone
in interfaceIUndoneResultListener<E>
- Parameters:
exception
- The exception.
-
isUndone
public boolean isUndone()
Get the undone.- Returns:
- The undone.
-
-