java.lang.Object
software.amazon.smithy.rulesengine.language.syntax.expressions.Template
All Implemented Interfaces:
FromSourceLocation, ToNode

public final class Template extends Object implements FromSourceLocation, ToNode
Template represents a "Template Literal". This is a literal string within the rules language. A template can contain 0 or more dynamic sections. The dynamic sections use getAttr short-form:

`https://{Region}.{partition#dnsSuffix}` -------- ------------ | | Dynamic getAttr short form

  • Constructor Details

  • Method Details

    • fromString

      public static Template fromString(String s)
    • getSourceLocation

      public SourceLocation getSourceLocation()
      Description copied from interface: FromSourceLocation
      Gets the source location of a value.
      Specified by:
      getSourceLocation in interface FromSourceLocation
      Returns:
      Returns the source location of the value.
    • accept

      public <T> Stream<T> accept(TemplateVisitor<T> visitor)
    • getParts

      public List<Template.Part> getParts()
    • isStatic

      public boolean isStatic()
      Gets if the template is static or not.
      Returns:
      true if all template parts are literals, false otherwise.
    • expectLiteral

      public String expectLiteral()
      Returns the literal value of this template, throwing RuntimeException if the template is not static.
      Returns:
      returns the string literal value.
    • typeCheck

      public Type typeCheck(Scope<Type> scope)
      Evaluates this template in the provided scope.
      Parameters:
      scope - the scope to check this template within.
      Returns:
      the type of the template.
    • toNode

      public Node toNode()
      Description copied from interface: ToNode
      Converts a value to a Node.
      Specified by:
      toNode in interface ToNode
      Returns:
      Returns the creates Node.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object