Class Expression
- java.lang.Object
- 
- software.amazon.smithy.rulesengine.language.syntax.SyntaxElement
- 
- software.amazon.smithy.rulesengine.language.syntax.expressions.Expression
 
 
- 
- All Implemented Interfaces:
- FromSourceLocation,- ToNode,- TypeCheck,- ToCondition,- ToExpression
 - Direct Known Subclasses:
- LibraryFunction,- Literal,- Reference
 
 public abstract class Expression extends SyntaxElement implements FromSourceLocation, ToNode, TypeCheck A dynamically computed expression.Expressions are the fundamental building block of the rule language. 
- 
- 
Constructor SummaryConstructors Constructor Description Expression(SourceLocation sourceLocation)
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract <R> Raccept(ExpressionVisitor<R> visitor)Invoke theExpressionVisitorfunctions for this expression.abstract booleanequals(java.lang.Object obj)static ExpressionfromNode(Node node)Constructs an expression from the providedNode.static LiteralgetLiteral(StringNode node)Constructs aLiteralfrom the givenStringNode.static ReferencegetReference(Identifier name, FromSourceLocation context)Constructs aReferencefor the givenIdentifierat the given location.SourceLocationgetSourceLocation()Gets the source location of a value.abstract inthashCode()static Literalof(boolean value)static Literalof(int value)Construct an integer literal for the given value, and returns it as an expression.static Literalof(java.lang.String value)Constructs a string literal for the given values.static ExpressionparseShortform(java.lang.String shortForm, FromSourceLocation context)Parse a value from a "short form" used within a template.Condition.BuildertoConditionBuilder()Convert this into a condition builder for compositional use.ExpressiontoExpression()Convert this into an expression.Typetype()Returns the type for this expression, throws a runtime exception iftypeCheckhas not been invoked.TypetypeCheck(Scope<Type> scope)Checks whether the given types within a scope satisfy the constraints.protected abstract TypetypeCheckLocal(Scope<Type> scope)- 
Methods inherited from class software.amazon.smithy.rulesengine.language.syntax.SyntaxElementbooleanEqual, getAttr, getAttr, isSet, isValidHostLabel, not, parseUrl, stringEqual, substring, template
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface software.amazon.smithy.rulesengine.language.syntax.ToConditiontoCondition, toCondition
 
- 
 
- 
- 
- 
Constructor Detail- 
Expressionpublic Expression(SourceLocation sourceLocation) 
 
- 
 - 
Method Detail- 
ofpublic static Literal of(boolean value) 
 - 
ofpublic static Literal of(int value) Construct an integer literal for the given value, and returns it as an expression.- Parameters:
- value- the integer value.
- Returns:
- the integer value as a literal expression.
 
 - 
ofpublic static Literal of(java.lang.String value) Constructs a string literal for the given values.- Parameters:
- value- the string value.
- Returns:
- the string value as a literal.
 
 - 
fromNodepublic static Expression fromNode(Node node) Constructs an expression from the providedNode.- Parameters:
- node- the node to construct the expression from.
- Returns:
- the expression.
 
 - 
parseShortformpublic static Expression parseShortform(java.lang.String shortForm, FromSourceLocation context) Parse a value from a "short form" used within a template.- Parameters:
- shortForm- the shortform value
- Returns:
- the parsed expression
 
 - 
getReferencepublic static Reference getReference(Identifier name, FromSourceLocation context) Constructs aReferencefor the givenIdentifierat the given location.- Parameters:
- name- the referenced identifier.
- context- the source location.
- Returns:
- the reference.
 
 - 
getLiteralpublic static Literal getLiteral(StringNode node) Constructs aLiteralfrom the givenStringNode.- Parameters:
- node- the node to construct the literal from.
- Returns:
- the string node as a literal.
 
 - 
acceptpublic abstract <R> R accept(ExpressionVisitor<R> visitor) Invoke theExpressionVisitorfunctions for this expression.- Type Parameters:
- R- the visitor return type.
- Parameters:
- visitor- the visitor to be invoked.
- Returns:
- the return value of the visitor.
 
 - 
typeCheckLocalprotected abstract Type typeCheckLocal(Scope<Type> scope) throws InnerParseError - Throws:
- InnerParseError
 
 - 
typepublic Type type() Returns the type for this expression, throws a runtime exception iftypeCheckhas not been invoked.- Returns:
- the type.
 
 - 
toConditionBuilderpublic Condition.Builder toConditionBuilder() Description copied from interface:ToConditionConvert this into a condition builder for compositional use.- Specified by:
- toConditionBuilderin interface- ToCondition
- Returns:
- the condition builder.
 
 - 
toExpressionpublic Expression toExpression() Description copied from interface:ToExpressionConvert this into an expression.- Specified by:
- toExpressionin interface- ToExpression
- Returns:
- the expression.
 
 - 
hashCodepublic abstract int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic abstract boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 - 
getSourceLocationpublic SourceLocation getSourceLocation() Description copied from interface:FromSourceLocationGets the source location of a value.- Specified by:
- getSourceLocationin interface- FromSourceLocation
- Returns:
- Returns the source location of the value.
 
 
- 
 
-