Package ortus.boxlang.runtime.context
Class CatchBoxContext
java.lang.Object
ortus.boxlang.runtime.context.BaseBoxContext
ortus.boxlang.runtime.context.ParentPassthroughBoxContext
ortus.boxlang.runtime.context.CatchBoxContext
- All Implemented Interfaces:
Serializable,IBoxContext,IBoxAttachable
This context represents the context of a template execution in BoxLang
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ortus.boxlang.runtime.context.IBoxContext
IBoxContext.ScopeSearchResult -
Field Summary
Fields inherited from class ortus.boxlang.runtime.context.BaseBoxContext
buffers, components, currentImports, nullIsUndefined, parent, queryLoops, templates -
Constructor Summary
ConstructorsConstructorDescriptionCatchBoxContext(IBoxContext parent, Key exceptionKey, Throwable exception) Creates a new execution context with a bounded execution template and parent context -
Method Summary
Modifier and TypeMethodDescriptionGet a scope from the context.getScopeNearby(Key name, boolean shallow) Get a scope from the context.getVisibleScopes(IStruct scopes, boolean nearby, boolean shallow) -------------------------------------------------------------------------- Getters + Setters --------------------------------------------------------------------------booleanisKeyVisibleScope(Key key, boolean nearby, boolean shallow) Check if a key is visible in the current context as a scope name.voidrethrow()rethrows the closest exceptionTry to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context.scopeFindNearby(Key key, IScope defaultScope, boolean shallow, boolean forAssign) Try to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context.Methods inherited from class ortus.boxlang.runtime.context.ParentPassthroughBoxContext
canOutput, clearBuffer, findClosestComponent, findClosestComponent, flushBuffer, getBuffer, getComponents, getDefaultAssignmentScope, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, invokeFunction, popBuffer, popComponent, pushBuffer, pushComponent, writeToBuffer, writeToBufferMethods inherited from class ortus.boxlang.runtime.context.BaseBoxContext
clearConfigCache, computeAttachmentIfAbsent, findBaseTemplate, findBIF, findClosestComponent, findClosestComponent, findClosestFunctionName, findClosestTemplate, findFunction, getApplicationContext, getAttachment, getAttachmentKeys, getConfig, getConfigItem, getConfigItem, getConfigItems, getCurrentImports, getFunctionClass, getFunctionInterface, getFunctionParentContext, getFunctionStaticClass, getLogger, getModuleRecord, getModuleSettings, getParent, getParentOfType, getQueryRow, getRequestContext, getRuntime, getScopeNearby, getTemplates, getVisibleScopes, hasAttachment, hasParent, hasTemplates, includeTemplate, incrementQueryLoop, injectParentContext, injectTopParentContext, invokeComponent, invokeFunction, invokeFunction, isDefined, isInOutputComponent, isKeyVisibleScope, navigateConfig, popTemplate, pushTemplate, pushTemplate, putAttachment, queryFindNearby, registerQueryLoop, registerUDF, registerUDF, removeAttachment, removeParentContext, scopeFindNearby, setParent, unregisterQueryLoop, unwrapQueryColumnMethods 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, registerUDF, shutdown, startup
-
Constructor Details
-
CatchBoxContext
Creates a new execution context with a bounded execution template and parent context- Parameters:
parent- The parent contextexceptionKey- The key to use for the exceptionexception- The exception to store
-
-
Method Details
-
getVisibleScopes
-------------------------------------------------------------------------- Getters + Setters --------------------------------------------------------------------------- Specified by:
getVisibleScopesin interfaceIBoxContext- Overrides:
getVisibleScopesin classParentPassthroughBoxContext- 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 classParentPassthroughBoxContext- 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) Try to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context. A nearby lookup is used for the closest context to the executing code- Specified by:
scopeFindNearbyin interfaceIBoxContext- Overrides:
scopeFindNearbyin classParentPassthroughBoxContext- Parameters:
key- The key to search fordefaultScope- The default scope to use if the key is not foundshallow- true, do not delegate to parent or default scope if not foundforAssign- true, this is for an assignment operation- Returns:
- The value of the key if found
-
scopeFind
Try to get the requested key from the unscoped scope Meaning it needs to search scopes in order according to it's context. Unlike scopeFindNearby(), this version only searches trancedent scopes like cgi or server which are never encapsulated like variables is inside a class.- Specified by:
scopeFindin interfaceIBoxContext- Overrides:
scopeFindin classParentPassthroughBoxContext- 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 value of the key if found
-
getScope
Get a scope from the context. If not found, the parent context is asked. Don't search for scopes which are nearby to an execution context- Specified by:
getScopein interfaceIBoxContext- Overrides:
getScopein classParentPassthroughBoxContext- Parameters:
name- The name of the scope to get- Returns:
- The requested scope
-
getScopeNearby
Get a scope from the context. If not found, the parent context is asked. Search all konwn scopes- Specified by:
getScopeNearbyin interfaceIBoxContext- Overrides:
getScopeNearbyin classParentPassthroughBoxContext- Parameters:
name- The name of the scope to getshallow- true, do not delegate to parent or default scope if not found- Returns:
- The requested scope
-
rethrow
public void rethrow()rethrows the closest exception- Specified by:
rethrowin interfaceIBoxContext- Overrides:
rethrowin classBaseBoxContext
-