Package sleep.engine
Class CallRequest
- java.lang.Object
-
- sleep.engine.CallRequest
-
- Direct Known Subclasses:
CallRequest.ClosureCallRequest
,CallRequest.FunctionCallRequest
,CallRequest.InlineCallRequest
public abstract class CallRequest extends java.lang.Object
This class encapsulates a function call request. Sleep has too many reasons, places, and ways to call functions. This class helps to avoid duplicate code and manage the complexity of Sleep's myriad of profiling, tracing, and error reporting options. This functionality is encapsulated (along with necessary setup/teardown that you don't want to touch) within SleepUtils.runCode().- See Also:
SleepUtils
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CallRequest.ClosureCallRequest
execute a closure with all of the trimmings.static class
CallRequest.FunctionCallRequest
execute a function with all of the debug, trace, etc..static class
CallRequest.InlineCallRequest
execute a block of code inline with all the profiling, tracing, and other support
-
Field Summary
Fields Modifier and Type Field Description protected ScriptEnvironment
environment
protected int
lineNumber
-
Constructor Summary
Constructors Constructor Description CallRequest(ScriptEnvironment e, int lineNo)
initialize a new call request
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
CallFunction()
actually execute the function callprotected abstract Scalar
execute()
execute the function call contained hereprotected abstract java.lang.String
formatCall(java.lang.String args)
return a string view of this function call for trace messages; arguments are captured as comma separated descriptions of all argsabstract java.lang.String
getFrameDescription()
return the description of this current stack frame in the event of an exceptionabstract java.lang.String
getFunctionName()
return the name of the function (for use in profiler statistics)int
getLineNumber()
returns the line number this function call is occuring fromprotected ScriptEnvironment
getScriptEnvironment()
returns the script environment...boolean
isDebug()
return true if debug trace is enabled.
-
-
-
Field Detail
-
environment
protected ScriptEnvironment environment
-
lineNumber
protected int lineNumber
-
-
Constructor Detail
-
CallRequest
public CallRequest(ScriptEnvironment e, int lineNo)
initialize a new call request
-
-
Method Detail
-
getScriptEnvironment
protected ScriptEnvironment getScriptEnvironment()
returns the script environment... pHEAR
-
getLineNumber
public int getLineNumber()
returns the line number this function call is occuring from
-
getFunctionName
public abstract java.lang.String getFunctionName()
return the name of the function (for use in profiler statistics)
-
getFrameDescription
public abstract java.lang.String getFrameDescription()
return the description of this current stack frame in the event of an exception
-
execute
protected abstract Scalar execute()
execute the function call contained here
-
formatCall
protected abstract java.lang.String formatCall(java.lang.String args)
return a string view of this function call for trace messages; arguments are captured as comma separated descriptions of all args
-
isDebug
public boolean isDebug()
return true if debug trace is enabled. override this to add/change criteria for trace activiation
-
CallFunction
public void CallFunction()
actually execute the function call
-
-