|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.finra.jtaf.core.model.invocationtarget.InvocationTarget
org.finra.jtaf.core.model.invocationtarget.Command
public abstract class Command
Implements basic methods, but leaves execution phase abstract
Field Summary | |
---|---|
Interpreter |
interpreter
|
protected boolean |
recordResult
|
Fields inherited from class org.finra.jtaf.core.model.invocationtarget.InvocationTarget |
---|
globalContext |
Constructor Summary | |
---|---|
Command(String name)
|
Method Summary | |
---|---|
void |
acceptInvocationTargetVisitor(Interpreter v)
This is used by the interpreter so that the visitCommand method is called, allowing the interpreter to not have to know what kind of InvocationTarget it is executing. |
void |
clearContext()
Used to clear the context. |
protected void |
deinitialize(IInvocationContext ctx)
Optional method to deinitialize a command after execution. |
protected abstract void |
execute(IInvocationContext ctx)
This method should be overridden by every Command object. |
protected void |
executeInvocation(Invocation child)
Used by other commands to execute invocations in their bodies. |
protected boolean |
getBooleanOrDefault(String attributeName,
boolean defaultValue)
Get a boolean stored in the context or return a default value. |
protected IInvocationContext |
getContext()
Internal method: Used to share the current Context between methods without having to pass it explicitly. |
protected float |
getFloatOrDefault(String attributeName,
float defaultValue)
Get a float stored in the context or return a default value. |
protected int |
getIntegerOrDefault(String attributeName,
int defaultValue)
Get an integer stored in the context or return a default value. |
protected Object |
getOptionalObject(String key)
Grabs an Object from the Context. |
protected String |
getOptionalString(String attributeName)
Get a string that was stored in the context as an optional parameter. |
protected boolean |
getRequiredBoolean(String attributeName)
Get a boolean that was stored in the context as a required parameter. |
protected float |
getRequiredFloat(String attributeName)
Get a float that was stored in the context as an required parameter. |
protected int |
getRequiredInteger(String attributeName)
Get an integer that was stored in the context as an required parameter. |
protected Object |
getRequiredObject(String key)
Get an object that was stored in the context as an required parameter. |
protected String |
getRequiredString(String attributeName)
Get a string that was stored in the context as an required parameter. |
protected String |
getStringOrDefault(String attributeName,
String defaultValue)
Get a string stored in the context or return a default value. |
protected void |
initialize(IInvocationContext ctx)
Optional method to initialize a command before execution |
void |
launch(IInvocationContext ctx,
Interpreter interpreter)
Sets up the context before executing the actual command. |
protected boolean |
recordResult()
Used to check whether or not this command needs to have its details recorded in testStepDetails. |
Methods inherited from class org.finra.jtaf.core.model.invocationtarget.InvocationTarget |
---|
addOptionalParameter, addProduction, addRequiredParameter, cleanGlobalContext, getAllParameters, getFromGlobalContext, getGlobalContext, getName, getOptionalParameters, getProductions, getRequiredParameters, getUsage, putToGlobalContext, setGlobalContext, setUsage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean recordResult
public Interpreter interpreter
Constructor Detail |
---|
public Command(String name) throws NameFormatException
NameFormatException
Method Detail |
---|
protected final IInvocationContext getContext()
public final void launch(IInvocationContext ctx, Interpreter interpreter) throws Throwable
ctx
- - the current context when the command is being executedinterpreter
- - the interpreter that is executing the command
Throwable
protected void initialize(IInvocationContext ctx) throws Throwable
ctx
-
Throwable
protected abstract void execute(IInvocationContext ctx) throws Throwable
ctx
-
Exception
Throwable
protected void deinitialize(IInvocationContext ctx) throws Throwable
ctx
-
Throwable
protected Object getOptionalObject(String key)
key
-
protected Object getRequiredObject(String key)
key
- - key of object in context
protected final int getRequiredInteger(String attributeName)
attributeName
- - key of object in context
protected final int getIntegerOrDefault(String attributeName, int defaultValue)
attributeName
- - key of object in contextdefaultValue
- - the default value if the attributeName has no associated
value in the context.
protected final float getRequiredFloat(String attributeName)
attributeName
- - key of object in context
protected final float getFloatOrDefault(String attributeName, float defaultValue)
attributeName
- - key of object in contextdefaultValue
- - the default value if the attributeName has no associated
value in the context.
protected final String getRequiredString(String attributeName)
attributeName
- - key of object in context
protected final String getStringOrDefault(String attributeName, String defaultValue)
attributeName
- - key of object in contextdefaultValue
- - the default value if the attributeName has no associated
value in the context.
protected final String getOptionalString(String attributeName)
attributeName
- - key of object in context
protected final boolean getRequiredBoolean(String attributeName)
attributeName
- - key of object in context
protected final boolean getBooleanOrDefault(String attributeName, boolean defaultValue)
attributeName
- - key of object in contextdefaultValue
- - the default value if the attributeName has no associated
value in the context.
public final void acceptInvocationTargetVisitor(Interpreter v) throws Throwable
acceptInvocationTargetVisitor
in class InvocationTarget
v
- - the interpreter executing this command
Throwable
protected boolean recordResult()
protected void executeInvocation(Invocation child) throws Throwable
child
- - the command in the block
Throwable
public void clearContext()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |