Package org.apache.sling.scripting.sightly.impl.compiler.frontend

## 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
`Interpolation()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addExpression​(Expression expression)`
`void` `addFragment​(Fragment fragment)`
`void` `addText​(String text)`
`String` `getContent()`
`Fragment` `getFragment​(int index)` Return the fragment with the specified index
`Iterable<Fragment>` `getFragments()`
`void` `setContent​(String content)`
`int` `size()` Get the number of fragments
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### Interpolation

    public Interpolation()

### 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

#### getFragments

    public Iterable<Fragment> getFragments()

#### getContent

    public String getContent()

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`