Package ortus.boxlang.runtime.context
Class StaticClassBoxContext
java.lang.Object
ortus.boxlang.runtime.context.BaseBoxContext
ortus.boxlang.runtime.context.StaticClassBoxContext
- All Implemented Interfaces:
Serializable,IBoxContext,IBoxAttachable
This context represents the static constructor of a box class
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ortus.boxlang.runtime.context.IBoxContext
IBoxContext.ScopeSearchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DynamicObjectThe class in which this function is executing, if anyprotected IScopeThe static scopeFields inherited from class ortus.boxlang.runtime.context.BaseBoxContext
buffers, components, currentImports, nullIsUndefined, parent, queryLoops, templates -
Constructor Summary
ConstructorsConstructorDescriptionStaticClassBoxContext(IBoxContext parent, DynamicObject staticBoxClass, StaticScope staticScope) Creates a new execution context with a bounded function instance and parent context -
Method Summary
Modifier and TypeMethodDescriptionA helper to look at the "output" annotation, caching the resultflushBuffer(boolean force) Flush the buffer to the output stream and then clears the local buffersGet the default variable assignment scope for this contextGet parent context for a function execution happening in this contextLook for a scope by namegetScopeNearby(Key name, boolean shallow) Look for a "nearby" scope by namegetVisibleScopes(IStruct scopes, boolean nearby, boolean shallow) This is mostly for the debugger.booleanisKeyVisibleScope(Key key, boolean nearby, boolean shallow) Check if a key is visible in the current context as a scope name.voidregisterUDF(UDF udf, boolean override) Register a UDF with the local context choosing to override.Search for a variable in scopesscopeFindNearby(Key key, IScope defaultScope, boolean shallow, boolean forAssign) Search for a variable in "nearby" scopesMethods inherited from class ortus.boxlang.runtime.context.BaseBoxContext
clearBuffer, clearConfigCache, computeAttachmentIfAbsent, findBaseTemplate, findBIF, findClosestComponent, findClosestComponent, findClosestComponent, findClosestComponent, findClosestFunctionName, findClosestTemplate, findFunction, getApplicationContext, getAttachment, getAttachmentKeys, getBuffer, getComponents, getConfig, getConfigItem, getConfigItem, getConfigItems, getCurrentImports, getFunctionClass, getFunctionInterface, getFunctionStaticClass, getLogger, getModuleRecord, getModuleSettings, getParent, getParentOfType, getQueryRow, getQueryRow, getRequestContext, getRuntime, getScopeNearby, getTemplates, getVisibleScopes, hasAttachment, hasParent, hasTemplates, includeTemplate, incrementQueryLoop, injectParentContext, injectTopParentContext, invokeComponent, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, isDefined, isInOutputComponent, isKeyVisibleScope, navigateConfig, popBuffer, popComponent, popTemplate, pushBuffer, pushComponent, pushTemplate, pushTemplate, putAttachment, queryFindNearby, registerQueryLoop, registerUDF, removeAttachment, removeParentContext, rethrow, scopeFindNearby, setParent, unregisterQueryLoop, unwrapQueryColumn, writeToBuffer, writeToBufferMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ortus.boxlang.runtime.context.IBoxContext
getApplicationCache, getApplicationName, includeTemplate, registerUDF, shutdown, startup
-
Field Details
-
staticScope
The static scope -
staticBoxClass
The class in which this function is executing, if any
-
-
Constructor Details
-
StaticClassBoxContext
public StaticClassBoxContext(IBoxContext parent, DynamicObject staticBoxClass, StaticScope staticScope) Creates a new execution context with a bounded function instance and parent context- Parameters:
parent- The parent contextstaticBoxClass- Static class instance for a boxlang classstaticScope- The static scope to use
-
-
Method Details
-
getVisibleScopes
Description copied from class:BaseBoxContextThis is mostly for the debugger. It returns all visible scopes from this context.- Specified by:
getVisibleScopesin interfaceIBoxContext- Overrides:
getVisibleScopesin classBaseBoxContext- Returns:
- A struct containing all contextual and lexically visible scopes
-
isKeyVisibleScope
Check if a key is visible in the current context as a scope name. This allows us to "reserve" known scope names to ensure arguments.foo will always look in the proper arguments scope and never in local.arguments.foo for example- Specified by:
isKeyVisibleScopein interfaceIBoxContext- Overrides:
isKeyVisibleScopein classBaseBoxContext- Parameters:
key- The key to check for visibilitynearby- true, check only scopes that are nearby to the current execution contextshallow- true, do not delegate to parent or default scope if not found- Returns:
- True if the key is visible in the current context, else false
-
scopeFindNearby
public IBoxContext.ScopeSearchResult scopeFindNearby(Key key, IScope defaultScope, boolean shallow, boolean forAssign) Search for a variable in "nearby" scopes- Specified by:
scopeFindNearbyin interfaceIBoxContext- Overrides:
scopeFindNearbyin classBaseBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to use if the key is not foundshallow- Whether to search only the "nearby" scopes or all scopesforAssign- true, this is for an assignment operation- Returns:
- The search result
-
scopeFind
Search for a variable in scopes- Specified by:
scopeFindin interfaceIBoxContext- Overrides:
scopeFindin classBaseBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to use if the key is not foundforAssign- true, this is for an assignment operation- Returns:
- The search result
-
getScope
Look for a scope by name- Specified by:
getScopein interfaceIBoxContext- Overrides:
getScopein classBaseBoxContext- Parameters:
name- The name of the scope to look for- Returns:
- The scope reference to use
- Throws:
ScopeNotFoundException- If the scope was not found in any context
-
getScopeNearby
Look for a "nearby" scope by name- Specified by:
getScopeNearbyin interfaceIBoxContext- Overrides:
getScopeNearbyin classBaseBoxContext- Parameters:
name- The name of the scope to look forshallow- true, do not delegate to parent or default scope if not found- Returns:
- The scope reference to use
- Throws:
ScopeNotFoundException- If the scope was not found in any context
-
getDefaultAssignmentScope
Get the default variable assignment scope for this context- Specified by:
getDefaultAssignmentScopein interfaceIBoxContext- Overrides:
getDefaultAssignmentScopein classBaseBoxContext- Returns:
- The scope reference to use
-
getFunctionParentContext
Get parent context for a function execution happening in this context- Specified by:
getFunctionParentContextin interfaceIBoxContext- Overrides:
getFunctionParentContextin classBaseBoxContext- Returns:
- The context to use
-
registerUDF
Description copied from class:BaseBoxContextRegister a UDF with the local context choosing to override.- Specified by:
registerUDFin interfaceIBoxContext- Overrides:
registerUDFin classBaseBoxContext- Parameters:
udf- The UDF to registeroverride- true, override any existing UDF with the same name
-
flushBuffer
Flush the buffer to the output stream and then clears the local buffers- Specified by:
flushBufferin interfaceIBoxContext- Overrides:
flushBufferin classBaseBoxContext- Parameters:
force- true, flush even if output is disabled- Returns:
- This context
-
canOutput
A helper to look at the "output" annotation, caching the result- Specified by:
canOutputin interfaceIBoxContext- Overrides:
canOutputin classBaseBoxContext- Returns:
- Whether the function can output
-