Package jadex.future
Class DelegationResultListener<E>
java.lang.Object
jadex.future.DelegationResultListener<E>
- All Implemented Interfaces:
IFutureCommandResultListener<E>,IResultListener<E>,IUndoneResultListener<E>
public class DelegationResultListener<E>
extends Object
implements IResultListener<E>, IFutureCommandResultListener<E>, IUndoneResultListener<E>
Result listener that delegates calls to a future.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDelegationResultListener(Future<E> future) Create a new listener.DelegationResultListener(Future<E> future, boolean undone) Create a new listener.DelegationResultListener(Future<E> future, boolean undone, Consumer<E> customResultListener) Create a new listener.DelegationResultListener(Future<E> future, Consumer<E> customResultListener) Create a new listener. -
Method Summary
Modifier and TypeMethodDescriptionvoidcommandAvailable(Object command) Called when a command is available.voidcustomResultAvailable(E result) Called when the result is available.voidexceptionOccurred(Exception exception) Called when an exception occurred.voidexceptionOccurredIfUndone(Exception exception) Called when an exception occurred.booleanisUndone()Get the undone.final voidresultAvailable(E result) Called when the result is available.voidresultAvailableIfUndone(E result) Called when the result is available.
-
Field Details
-
future
The future to which calls are delegated. -
undone
protected boolean undoneFlag if undone methods should be used. -
customResultListener
Custom functional result listener
-
-
Constructor Details
-
DelegationResultListener
Create a new listener. -
DelegationResultListener
Create a new listener.- Parameters:
future- The delegation target.customResultListener- Custom result listener that overwrites the delegation behaviour.
-
DelegationResultListener
Create a new listener.- Parameters:
future- The delegation target.undone- use undone methods.customResultListener- Custom result listener that overwrites the delegation behaviour.
-
DelegationResultListener
Create a new listener.
-
-
Method Details
-
resultAvailable
Called when the result is available.- Specified by:
resultAvailablein interfaceIResultListener<E>- Parameters:
result- The result.
-
customResultAvailable
Called when the result is available.- Parameters:
result- The result.
-
exceptionOccurred
Called when an exception occurred.- Specified by:
exceptionOccurredin interfaceIResultListener<E>- Parameters:
exception- The exception.
-
commandAvailable
Called when a command is available.- Specified by:
commandAvailablein interfaceIFutureCommandResultListener<E>
-
resultAvailableIfUndone
Called when the result is available.- Specified by:
resultAvailableIfUndonein interfaceIUndoneResultListener<E>- Parameters:
result- The result.
-
exceptionOccurredIfUndone
Called when an exception occurred.- Specified by:
exceptionOccurredIfUndonein interfaceIUndoneResultListener<E>- Parameters:
exception- The exception.
-
isUndone
public boolean isUndone()Get the undone.- Returns:
- The undone.
-