public final class SoyExpression extends Expression
Expression.Feature, Expression.Features| Modifier and Type | Field and Description |
|---|---|
static SoyExpression |
FALSE |
static SoyExpression |
NULL |
static SoyExpression |
NULL_BOXED |
static SoyExpression |
TRUE |
location| Modifier and Type | Method and Description |
|---|---|
static Expression |
asBoxedList(List<SoyExpression> items)
Returns an Expression that evaluates to a list containing all the items as boxed soy values.
|
SoyExpression |
asCheap()
Returns an equivalent expression where
Expression.isCheap() returns true. |
SoyExpression |
asNonNullable()
Returns an equivalent expression where
Expression.isNonNullable() returns true. |
SoyExpression |
asNullable() |
boolean |
assignableToNullableFloat() |
boolean |
assignableToNullableInt() |
boolean |
assignableToNullableNumber() |
boolean |
assignableToNullableString() |
SoyExpression |
box()
Returns a SoyExpression that evaluates to a subtype of
SoyValue. |
Expression |
boxAsSoyValueProvider()
Returns an Expression of a non-null
SoyValueProvider providing this value. |
SoyExpression |
coerceToBoolean()
Coerce this expression to a boolean value.
|
SoyExpression |
coerceToDouble()
Coerce this expression to a double value.
|
SoyExpression |
coerceToString()
Coerce this expression to a string value.
|
protected void |
doGen(CodeBuilder adapter)
Generate code to evaluate the expression.
|
static SoyExpression |
forBool(Expression delegate) |
static SoyExpression |
forFloat(Expression delegate) |
static SoyExpression |
forInt(Expression delegate) |
static SoyExpression |
forLegacyObjectMap(LegacyObjectMapType mapType,
Expression delegate) |
static SoyExpression |
forList(ListType listType,
Expression delegate) |
static SoyExpression |
forMap(MapType mapType,
Expression delegate) |
static SoyExpression |
forProto(SoyRuntimeType type,
Expression delegate) |
static SoyExpression |
forSanitizedString(Expression delegate,
SanitizedContentKind kind) |
static SoyExpression |
forSoyValue(SoyType type,
Expression delegate) |
static SoyExpression |
forString(Expression delegate) |
boolean |
isBoxed() |
SoyExpression |
labelEnd(org.objectweb.asm.Label label)
Returns a new expression identical to this one but with the given label applied at the end of
the expression.
|
SoyExpression |
labelStart(org.objectweb.asm.Label label)
Returns a new expression identical to this one but with the given label applied at the start of
the expression.
|
SoyRuntimeType |
soyRuntimeType()
Returns the
SoyRuntimeType of the expression. |
SoyType |
soyType()
Returns the
SoyType of the expression. |
SoyExpression |
unboxAs(Class<?> asType)
Unboxes this to a
SoyExpression with a runtime type of asType. |
SoyExpression |
withSource(Expression expr)
Returns a new
SoyExpression with the same type but a new delegate expression. |
SoyExpression |
withSourceLocation(SourceLocation location)
Returns an identical
Expression with the given source location. |
areAllCheap, areAllCheap, checkAssignableTo, checkAssignableTo, checkedCast, checkedCast, checkTypes, extraToStringProperties, features, invoke, invokeVoid, isCheap, isNonNullable, resultType, toStatement, toStringgen, tracepublic static final SoyExpression NULL
public static final SoyExpression NULL_BOXED
public static final SoyExpression TRUE
public static final SoyExpression FALSE
public static SoyExpression forSoyValue(SoyType type, Expression delegate)
public static SoyExpression forBool(Expression delegate)
public static SoyExpression forFloat(Expression delegate)
public static SoyExpression forInt(Expression delegate)
public static SoyExpression forString(Expression delegate)
public static SoyExpression forSanitizedString(Expression delegate, SanitizedContentKind kind)
public static SoyExpression forList(ListType listType, Expression delegate)
public static SoyExpression forLegacyObjectMap(LegacyObjectMapType mapType, Expression delegate)
public static SoyExpression forMap(MapType mapType, Expression delegate)
public static SoyExpression forProto(SoyRuntimeType type, Expression delegate)
public static Expression asBoxedList(List<SoyExpression> items)
public final SoyRuntimeType soyRuntimeType()
SoyRuntimeType of the expression.protected final void doGen(CodeBuilder adapter)
ExpressionThe generated code satisfies the invariant that the top of the runtime stack will contain a
value with this Expression.resultType() immediately after evaluation of the code.
doGen in class Expressionpublic SoyExpression withSourceLocation(SourceLocation location)
ExpressionExpression with the given source location.withSourceLocation in class Expressionpublic boolean assignableToNullableInt()
public boolean assignableToNullableFloat()
public boolean assignableToNullableNumber()
public boolean assignableToNullableString()
public boolean isBoxed()
public Expression boxAsSoyValueProvider()
SoyValueProvider providing this value.public SoyExpression box()
SoyValue.public SoyExpression coerceToBoolean()
public SoyExpression coerceToString()
public SoyExpression coerceToDouble()
public SoyExpression unboxAs(Class<?> asType)
SoyExpression with a runtime type of asType.
This method is appropriate when you know (likely via inspection of the soyType(),
or other means) that the value does have the appropriate type but you prefer to interact with
it as its unboxed representation. If you simply want to 'coerce' the given value to a new type
consider coerceToBoolean() coerceToDouble() or coerceToString()
which are designed for that use case.
public SoyExpression withSource(Expression expr)
SoyExpression with the same type but a new delegate expression.public SoyExpression asCheap()
ExpressionExpression.isCheap() returns true.asCheap in class Expressionpublic SoyExpression asNonNullable()
ExpressionExpression.isNonNullable() returns true.asNonNullable in class Expressionpublic SoyExpression asNullable()
asNullable in class Expressionpublic SoyExpression labelStart(org.objectweb.asm.Label label)
ExpressionlabelStart in class Expressionpublic SoyExpression labelEnd(org.objectweb.asm.Label label)
ExpressionlabelEnd in class Expression