Package io.deephaven.engine.context
Class QueryScope
java.lang.Object
io.deephaven.engine.context.QueryScope
- All Implemented Interfaces:
LogOutputAppendable
- Direct Known Subclasses:
AbstractScriptSession.ScriptSessionQueryScope,EmptyQueryScope,PoisonedQueryScope,QueryScope.StandaloneImpl
Variable scope used to resolve parameter values during query execution.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA type of RuntimeException thrown when a variable referenced within theQueryScopeis not defined or, more likely, has not been added to the scope.static class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddObjectFields(Object object) Adds an object's declared fields to the scope.static <T> voidAdds a parameter to the default instanceQueryScope, or updates the value of an existing parameter.protected abstract <T> QueryScopeParam<T>createParam(String name) Get a QueryScopeParam by name.Get all known scope variable names.final QueryScopeParam[]getParams(Collection<String> names) Get an array of Params by name.static <T> TgetParamValue(String name) Gets a parameter from the default instanceQueryScope.abstract booleanhasParamName(String name) Check if the scope has the given name.abstract voidputObjectFields(Object object) Add an object's public members (referenced reflectively, not a shallow copy!) to this scope if supported.abstract <T> voidAdd a parameter to the scope.abstract <T> TreadParamValue(String name) Get the value of a given scope parameter by name.abstract <T> TreadParamValue(String name, T defaultValue) Get the value of a given scope parameter by name.
-
Constructor Details
-
QueryScope
public QueryScope()
-
-
Method Details
-
addParam
Adds a parameter to the default instanceQueryScope, or updates the value of an existing parameter.- Type Parameters:
T- type of the parameter/value.- Parameters:
name- String name of the parameter to add.value- value to assign to the parameter.
-
addObjectFields
Adds an object's declared fields to the scope.- Parameters:
object- object whose fields will be added.
-
getParamValue
Gets a parameter from the default instanceQueryScope.- Type Parameters:
T- parameter type.- Parameters:
name- parameter name.- Returns:
- parameter value.
- Throws:
QueryScope.MissingVariableException- variable name is not defined.
-
getParams
public final QueryScopeParam[] getParams(Collection<String> names) throws QueryScope.MissingVariableException Get an array of Params by name. See createParam(name) implementations for details.- Parameters:
names- parameter names- Returns:
- A newly-constructed array of newly-constructed Params.
- Throws:
QueryScope.MissingVariableException- If any of the named scope variables does not exist.
-
getParamNames
Get all known scope variable names.- Returns:
- A collection of scope variable names.
-
hasParamName
Check if the scope has the given name.- Parameters:
name- param name- Returns:
- True iff the scope has the given param name
-
createParam
protected abstract <T> QueryScopeParam<T> createParam(String name) throws QueryScope.MissingVariableException Get a QueryScopeParam by name.- Parameters:
name- parameter name- Returns:
- newly-constructed QueryScopeParam (name + value-snapshot pair).
- Throws:
QueryScope.MissingVariableException- If any of the named scope variables does not exist.
-
readParamValue
Get the value of a given scope parameter by name.- Parameters:
name- parameter name.- Returns:
- parameter value.
- Throws:
QueryScope.MissingVariableException- If no such scope parameter exists.
-
readParamValue
Get the value of a given scope parameter by name.- Parameters:
name- parameter name.defaultValue- default parameter value.- Returns:
- parameter value, or the default parameter value, if the value is not present.
-
putParam
Add a parameter to the scope.- Parameters:
name- parameter name.value- parameter value.
-
putObjectFields
Add an object's public members (referenced reflectively, not a shallow copy!) to this scope if supported. Note: This is an optional method.- Parameters:
object- object to add public members from.
-
append
- Specified by:
appendin interfaceLogOutputAppendable
-