Class Reference
- 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.Reference
-
- All Implemented Interfaces:
FromSourceLocation
,ToNode
,TypeCheck
,ToCondition
,ToExpression
public final class Reference extends Expression
A reference to a field.
-
-
Constructor Summary
Constructors Constructor Description Reference(Identifier name, FromSourceLocation sourceLocation)
Creates a Reference for the identifier from the given source location.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> R
accept(ExpressionVisitor<R> visitor)
Invoke theExpressionVisitor
functions for this expression.boolean
equals(java.lang.Object o)
Identifier
getName()
Gets the name of the field being referenced.int
hashCode()
java.lang.String
template()
Converts this expression to a string template.Node
toNode()
Converts a value to aNode
.java.lang.String
toString()
protected Type
typeCheckLocal(Scope<Type> scope)
-
Methods inherited from class software.amazon.smithy.rulesengine.language.syntax.expressions.Expression
fromNode, getLiteral, getReference, getSourceLocation, 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
-
-
-
-
Constructor Detail
-
Reference
public Reference(Identifier name, FromSourceLocation sourceLocation)
Creates a Reference for the identifier from the given source location.- Parameters:
name
- the identifier being referenced.sourceLocation
- the source location for the reference.
-
-
Method Detail
-
getName
public Identifier getName()
Gets the name of the field being referenced.- Returns:
- the name of the referenced field.
-
template
public java.lang.String 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.
-
accept
public <R> R accept(ExpressionVisitor<R> visitor)
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
protected Type typeCheckLocal(Scope<Type> scope)
- Specified by:
typeCheckLocal
in classExpression
-
toNode
public Node toNode()
Description copied from interface:ToNode
Converts a value to aNode
.- Returns:
- Returns the creates Node.
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in classExpression
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classExpression
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-