@ParametersAreNonnullByDefault public interface SoyValue extends SoyValueProvider
Important: Until this API is more stable and this note is removed, users must not define classes that implement this interface.
SoyValueProvider.ResolveStatus| Modifier and Type | Method and Description |
|---|---|
boolean |
booleanValue()
Precondition: Only call this method if you know that this SoyValue object is a boolean.
|
boolean |
coerceToBoolean()
Coerces this value into a boolean.
|
String |
coerceToString()
Coerces this value into a string.
|
boolean |
equals(SoyValue other)
Compares this value against another for equality in the sense of the '==' operator of Soy.
|
double |
floatValue()
Precondition: Only call this method if you know that this SoyValue object is a float.
|
int |
integerValue()
Precondition: Only call this method if you know that this SoyValue object is a 32-bit integer.
|
long |
longValue()
Precondition: Only call this method if you know that this SoyValue object is an integer
or long.
|
double |
numberValue()
Precondition: Only call this method if you know that this SoyValue object is a number.
|
RenderResult |
render(AdvisingAppendable appendable,
boolean isLast)
Renders this value to the given
AdvisingAppendable, possibly partially. |
void |
render(Appendable appendable)
Renders this value to the given appendable.
|
String |
stringValue()
Precondition: Only call this method if you know that this SoyValue object is a string.
|
equals, resolve, statusboolean equals(SoyValue other)
other - The other value to compare against.boolean coerceToBoolean()
String coerceToString()
void render(Appendable appendable) throws IOException
This should behave identically to appendable.append(coerceToString()) but is
provided separately to allow more incremental approaches.
appendable - The appendable to render to.IOExceptionRenderResult render(AdvisingAppendable appendable, boolean isLast) throws IOException
AdvisingAppendable, possibly partially.
This should render the exact same content as render(Appendable) but may optionally
detach part of the way through rendering. Note, this means that this method is
stateful and if it returns something besides RenderResult.done() then the
next call to this method will resume rendering from the previous point.
It is expected that most implementations will simply delegate to
render(Appendable), since the renderable content is small/trivial.
appendable - The appendable to render to.isLast - True if this is definitely the last time this value will be rendered.
Used as a hint to implementations to not optimize for later calls (for example, by storing
render results in a buffer for faster re-renders). The value of this parameter should not
affect behavior of this method, only performance.IOException - If the appendable throws an IOExceptionboolean booleanValue()
SoyDataException - If this object is not actually a boolean.int integerValue()
SoyDataException - If this object is not actually an integer.long longValue()
SoyDataException - If this object is not actually an integer.double floatValue()
SoyDataException - If this object is not actually a float.double numberValue()
SoyDataException - If this object is not actually a number.String stringValue()
SoyDataException - If this object is not actually a string.