java.lang.Object
org.apache.sling.scripting.sightly.impl.compiler.frontend.Interpolation

public class Interpolation extends Object
A sequence with alternating string fragments and HTL expressions. These result from parsing HTML attributes or string nodes. For instance "Hello ${World}!" would result in 3 fragments: "Hello ", ${World} and "!"
  • Constructor Details

    • Interpolation

      public Interpolation()
  • Method Details

    • addFragment

      public void addFragment(Fragment fragment)
    • addExpression

      public void addExpression(Expression expression)
    • addText

      public void addText(String text)
    • setContent

      public void setContent(String content)
    • size

      public int size()
      Get the number of fragments
      Returns:
      the number of fragments
    • getFragment

      public Fragment getFragment(int index)
      Return the fragment with the specified index
      Parameters:
      index - - the index of the fragments. must be less than the size of the interpolation
      Returns:
      - the specified fragment
      Throws:
      IndexOutOfBoundsException - - if the index is negative or greater or equal than size
    • getFragments

      public Iterable<Fragment> getFragments()
    • getContent

      public String getContent()
    • toString

      public String toString()
      Overrides:
      toString in class Object