org.perfectjpattern.core.behavioral.command
Class Invoker<P,R>

java.lang.Object
  extended by org.perfectjpattern.core.behavioral.command.Invoker<P,R>
Type Parameters:
P - Command Parameter context-specific.
R - Command Result context-specific.
All Implemented Interfaces:
IInvoker<P,R>
Direct Known Subclasses:
ParameterlessInvoker

public class Invoker<P,R>
extends Object
implements IInvoker<P,R>

Base core implementation of IInvoker interface.

Version:
$Revision: 1.0 $ $Date: Jun 23, 2007 2:34:57 AM $
Author:
Giovanni Azua
See Also:
IInvoker
 

Constructor Summary
Invoker()
           
 
Method Summary
 R getResult()
          Returns the result of the execution of the ICommand.
 void invoke()
          Starts the appropriate ICommand.
 void setCommand(ICommand<P,R> aCommand)
          Sets the ICommand to start as result of executing the invoke method.
 void setParameter(P aParameter)
          Sets the parameter required for the execution of the target ICommand.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Invoker

public Invoker()
Method Detail

getResult

public R getResult()
            throws IllegalStateException
Returns the result of the execution of the ICommand.

Specified by:
getResult in interface IInvoker<P,R>
Returns:
Result of the execution of the ICommand.
Throws:
IllegalStateException - 'ICommand was not set'

invoke

public void invoke()
            throws IllegalStateException
Starts the appropriate ICommand.

Specified by:
invoke in interface IInvoker<P,R>
Throws:
IllegalStateException - 'ICommand was not set'

setCommand

public void setCommand(ICommand<P,R> aCommand)
Sets the ICommand to start as result of executing the invoke method.

Specified by:
setCommand in interface IInvoker<P,R>
Parameters:
aCommand - ICommand to set.

setParameter

public void setParameter(P aParameter)
                  throws IllegalArgumentException
Sets the parameter required for the execution of the target ICommand.

Specified by:
setParameter in interface IInvoker<P,R>
Parameters:
aParameter - Parameter required for the execution of the target ICommand.
Throws:
IllegalArgumentException - Underlying implementations will impose different preconditions on the aParameter argument


Copyright © 2007-2009. All Rights Reserved.