Class Interpolation
- 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 Summary
Constructors Constructor Description Interpolation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExpression(Expression expression)
void
addFragment(Fragment fragment)
void
addText(String text)
String
getContent()
Fragment
getFragment(int index)
Return the fragment with the specified indexIterable<Fragment>
getFragments()
void
setContent(String content)
int
size()
Get the number of fragmentsString
toString()
-
-
-
Method Detail
-
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
-
getContent
public String getContent()
-
-