Class Scope<T>
java.lang.Object
software.amazon.smithy.rulesengine.language.evaluation.Scope<T>
- Type Parameters:
- T- The type of values in scope.
Scope is a stack for tracking facts for named values of the given type.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionexpectValue(Identifier name) Gets the first value in scope for the specified identifier, throwingInnerParseErrorif the identifier is undefined in all the scope.Creates aScopeinstance from the given Node information.getDeclaration(Identifier name) Gets the first declaration in scope for the specified identifier.getValue(Identifier name) Gets the first value in scope for the specified identifier.<U> UAssesses a value supplier in the current scope.voidInserts a named value into the current scope.voidinsert(Identifier name, T value) Inserts a named value into the current scope.booleanGets if a reference is non-null in the current scope.voidpop()Pops the most recentScopeLayerout of the current scope.voidpush()Pushes an emptyScopeLayerinto the current scope.voidsetNonNull(Reference name) Inserts a non-null reference into the current scope.toString()
- 
Constructor Details- 
Scopepublic Scope()Crates a new, empty scope with a single layer.
 
- 
- 
Method Details- 
fromNodeCreates aScopeinstance from the given Node information.- Parameters:
- node- the node to deserialize.
- Returns:
- the created Scope.
 
- 
inScopeAssesses a value supplier in the current scope.- Type Parameters:
- U- the type of the value returned by the supplier.
- Parameters:
- supplier- the value supplier to assess.
- Returns:
- the value returned by the supplier.
 
- 
pushpublic void push()Pushes an emptyScopeLayerinto the current scope.
- 
poppublic void pop()Pops the most recentScopeLayerout of the current scope.
- 
insertInserts a named value into the current scope.- Parameters:
- name- the name of the value to insert.
- value- the value to insert.
 
- 
insertInserts a named value into the current scope.- Parameters:
- name- the name of the value to insert.
- value- the value to insert.
 
- 
setNonNullInserts a non-null reference into the current scope.- Parameters:
- name- the name of the reference to insert.
 
- 
isNonNullGets if a reference is non-null in the current scope.- Parameters:
- reference- the reference to check nullability for.
- Returns:
- true if the reference is non-null, false otherwise.
 
- 
getDeclarationGets the first declaration in scope for the specified identifier.- Parameters:
- name- the identifier to retrieve a declaration for.
- Returns:
- an optional of the declaration for the identifier, or empty otherwise.
 
- 
expectValueGets the first value in scope for the specified identifier, throwingInnerParseErrorif the identifier is undefined in all the scope.- Parameters:
- name- the identifier to retrieve a declaration for.
- Returns:
- the value for the identifier.
- Throws:
- InnerParseError- when the identifier has no value in the scope.
 
- 
getValueGets the first value in scope for the specified identifier.- Parameters:
- name- the identifier to retrieve a value for.
- Returns:
- an optional of the value for the identifier, or empty otherwise.
 
- 
toString
 
-