org.finra.jtaf.core.model.invocationtarget
Class InvocationTarget

java.lang.Object
  extended by org.finra.jtaf.core.model.invocationtarget.InvocationTarget
Direct Known Subclasses:
Command, Function

public abstract class InvocationTarget
extends Object

Common base class for any form of invocation target. TODO: Throw an exception if a parameter has already been defined?


Field Summary
protected static Map<String,Object> globalContext
           
 
Constructor Summary
InvocationTarget(String name)
          This is called when the InvocationTarget is instantiated by the interpreter.
 
Method Summary
abstract  void acceptInvocationTargetVisitor(Interpreter v)
          This is used by the interpreter to either execute the command or the function.
 void addOptionalParameter(String name)
          Add a new value as an optional parameter.
 void addProduction(String name)
          Add a new value to the production set.
 void addRequiredParameter(String name)
          Add a new value as a required parameter.
protected static void cleanGlobalContext()
          Used to clear all values from the global context.
 Set<String> getAllParameters()
          Get all of the parameters of this InvocationTarget.
static Object getFromGlobalContext(String key)
          Used to get an object from the global context that is associated with the passed in key.
protected static Map<String,Object> getGlobalContext()
           
 String getName()
          Get the name of this InvocationTarget
 Set<String> getOptionalParameters()
          Get all of the registered optional parameters of this InvocationTarget.
 Set<String> getProductions()
          Get all of the productions of this InvocationTarget.
 Set<String> getRequiredParameters()
          Get all of the required parameters of this InvocationTarget
 String getUsage()
          Get the usage of this InvocationTarget
protected static void putToGlobalContext(String key, Object value)
          Used to add values to the global context of the command.
protected static void setGlobalContext(Map<String,Object> contextGlobal)
          Used to set global context to be used by the command.
 void setUsage(String usage)
          Set the usage of this InvocationTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

globalContext

protected static Map<String,Object> globalContext
Constructor Detail

InvocationTarget

public InvocationTarget(String name)
                 throws NameFormatException
This is called when the InvocationTarget is instantiated by the interpreter. All sets used to keep track of the invocation targets parameters are instantiated as well.

Parameters:
name - - name of the invocation target.
Throws:
NameFormatException
Method Detail

getGlobalContext

protected static Map<String,Object> getGlobalContext()

setGlobalContext

protected static void setGlobalContext(Map<String,Object> contextGlobal)
Used to set global context to be used by the command.

Parameters:
contextGlobal - - The map to be used as the global context.

putToGlobalContext

protected static void putToGlobalContext(String key,
                                         Object value)
Used to add values to the global context of the command.

Parameters:
key - - the key to be used in the map.
value - - the value to be stored in the context.

getFromGlobalContext

public static Object getFromGlobalContext(String key)
Used to get an object from the global context that is associated with the passed in key.

Parameters:
key - - the key associated with the value in the global context
Returns:
the value in the context.

cleanGlobalContext

protected static void cleanGlobalContext()
Used to clear all values from the global context.


getName

public final String getName()
Get the name of this InvocationTarget

Returns:
the name of the target.

getUsage

public final String getUsage()
Get the usage of this InvocationTarget

Returns:
the usage of the target.

setUsage

public final void setUsage(String usage)
Set the usage of this InvocationTarget

Parameters:
usage - - the new value for this InvocationTargets usage

getRequiredParameters

public final Set<String> getRequiredParameters()
Get all of the required parameters of this InvocationTarget

Returns:
A read-only set of required parameters

addRequiredParameter

public final void addRequiredParameter(String name)
Add a new value as a required parameter.

Parameters:
name - - the name to be used for this required parameter.

getOptionalParameters

public final Set<String> getOptionalParameters()
Get all of the registered optional parameters of this InvocationTarget.

Returns:
the set containing all of the optional parameters.

addOptionalParameter

public final void addOptionalParameter(String name)
Add a new value as an optional parameter.

Parameters:
name - - the name to be used for this optional parameter.

getAllParameters

public final Set<String> getAllParameters()
Get all of the parameters of this InvocationTarget.

Returns:
the set containing all of the parameters.

getProductions

public final Set<String> getProductions()
Get all of the productions of this InvocationTarget.

Returns:
the set containing all of the productions.

addProduction

public final void addProduction(String name)
Add a new value to the production set.

Parameters:
name - - the name to be used for this production.

acceptInvocationTargetVisitor

public abstract void acceptInvocationTargetVisitor(Interpreter v)
                                            throws Throwable
This is used by the interpreter to either execute the command or the function.

Parameters:
v - - The interpreter that is executing this InvocationTarget.
Throws:
Throwable


Copyright © 2014. All rights reserved.