Class GetAttr
java.lang.Object
software.amazon.smithy.rulesengine.language.syntax.SyntaxElement
software.amazon.smithy.rulesengine.language.syntax.expressions.Expression
software.amazon.smithy.rulesengine.language.syntax.expressions.functions.LibraryFunction
software.amazon.smithy.rulesengine.language.syntax.expressions.functions.GetAttr
- All Implemented Interfaces:
FromSourceLocation
,ToNode
,TypeCheck
,ToCondition
,ToExpression
A rule-set expression for indexing a record/object or array.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
AFunctionDefinition
for theGetAttr
function.static interface
-
Field Summary
Fields inherited from class software.amazon.smithy.rulesengine.language.syntax.expressions.functions.LibraryFunction
definition, functionNode
-
Method Summary
Modifier and TypeMethodDescription<R> R
accept
(ExpressionVisitor<R> visitor) Invoke theExpressionVisitor
functions for this expression.boolean
Gets the value at the defined path out of the target value.static GetAttr.Definition
Gets theFunctionDefinition
implementation.getPath()
Gets the list ofGetAttr.Part
s that make up the path to the requested attribute.Gets the expression to retrieve an attribute of.int
hashCode()
static GetAttr
ofExpressions
(ToExpression arg1, String arg2) Creates aGetAttr
function from the given expressions.static GetAttr
ofExpressions
(ToExpression arg1, ToExpression arg2) Creates aGetAttr
function from the given expressions.template()
Converts this expression to a string template.toNode()
Converts a value to aNode
.toString()
protected Type
typeCheckLocal
(Scope<Type> scope) Methods inherited from class software.amazon.smithy.rulesengine.language.syntax.expressions.functions.LibraryFunction
expectOneArgument, getArguments, getName, getSourceLocation
Methods inherited from class software.amazon.smithy.rulesengine.language.syntax.expressions.Expression
fromNode, getLiteral, getReference, of, of, of, parseShortform, toConditionBuilder, toExpression, type, typeCheck
Methods inherited from class software.amazon.smithy.rulesengine.language.syntax.SyntaxElement
booleanEqual, getAttr, getAttr, isSet, isValidHostLabel, not, parseUrl, stringEqual, substring
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.smithy.rulesengine.language.syntax.ToCondition
toCondition, toCondition
-
Field Details
-
ID
- See Also:
-
-
Method Details
-
getDefinition
Gets theFunctionDefinition
implementation.- Returns:
- the function definition.
-
ofExpressions
Creates aGetAttr
function from the given expressions.- Parameters:
arg1
- the argument to extract from.arg2
- the path to extract.- Returns:
- The resulting
GetAttr
function.
-
ofExpressions
Creates aGetAttr
function from the given expressions.- Parameters:
arg1
- the argument to extract from.arg2
- the path to extract.- Returns:
- The resulting
GetAttr
function.
-
evaluate
Gets the value at the defined path out of the target value.- Parameters:
target
- the target value to retrieve a value out of.- Returns:
- the retrieve value.
-
getTarget
Gets the expression to retrieve an attribute of.- Returns:
- the expression targeted by this function.
-
getPath
Gets the list ofGetAttr.Part
s that make up the path to the requested attribute.- Returns:
- the list of path parts to the requested attribute.
-
accept
Description copied from class:Expression
Invoke theExpressionVisitor
functions for this expression.- Specified by:
accept
in classExpression
- Type Parameters:
R
- the visitor return type.- Parameters:
visitor
- the visitor to be invoked.- Returns:
- the return value of the visitor.
-
typeCheckLocal
- Overrides:
typeCheckLocal
in classLibraryFunction
-
template
Description copied from class:SyntaxElement
Converts this expression to a string template. By default, this implementation returns aRuntimeException
.- Overrides:
template
in classSyntaxElement
- Returns:
- the String template.
-
toNode
Description copied from interface:ToNode
Converts a value to aNode
.- Specified by:
toNode
in interfaceToNode
- Overrides:
toNode
in classLibraryFunction
- Returns:
- Returns the creates Node.
-
equals
- Overrides:
equals
in classLibraryFunction
-
hashCode
public int hashCode()- Overrides:
hashCode
in classLibraryFunction
-
toString
- Overrides:
toString
in classLibraryFunction
-