public final class JbcSrcRuntime extends Object
jbcsrc backend.
This class is public so it can be be used by generated template code. Please do not use it from client code.
| Modifier and Type | Field and Description |
|---|---|
static SoyValueProvider |
NULL_PROVIDER |
| Constructor and Description |
|---|
JbcSrcRuntime() |
| Modifier and Type | Method and Description |
|---|---|
static CompiledTemplate |
applyEscapers(CompiledTemplate delegate,
com.google.common.collect.ImmutableList<SoyJavaPrintDirective> directives)
Wraps a given template with a collection of escapers to apply.
|
static SoyValue |
applyPrintDirective(SoyJavaPrintDirective directive,
SoyValue value,
List<SoyValue> args)
Helper function to translate null -> NullData when calling SoyJavaPrintDirectives that may
expect it.
|
static SoyValue |
callSoyFunction(SoyJavaFunction function,
List<SoyValue> args)
Helper function to translate null -> NullData when calling SoyJavaFunctions that may expect it.
|
static boolean |
coerceToBoolean(double v) |
static String |
coerceToString(SoyValue v) |
static boolean |
compareNullableString(String string,
SoyValue other)
Determines if the operand's string form can be equality-compared with a string.
|
static SoyValueProvider |
getFieldProvider(SoyRecord record,
String field)
Helper function to make SoyRecord.getFieldProvider a non-nullable function by returning
NULL_PROVIDER for missing fields. |
static RenderResult |
getListStatus(List<? extends SoyValueProvider> soyValueProviders) |
static RenderResult |
getMapStatus(Map<String,? extends SoyValueProvider> soyValueProviders) |
static SoyValueProvider |
getSoyLegacyObjectMapItem(SoyLegacyObjectMap legacyObjectMap,
SoyValue key) |
static SoyValueProvider |
getSoyListItem(List<SoyValueProvider> list,
long index) |
static SoyValueProvider |
getSoyMapItem(SoyMap soyMap,
SoyValue key) |
static LoggingAdvisingAppendable |
logger() |
static com.google.template.soy.jbcsrc.runtime.JbcSrcRuntime.ClosePropagatingAppendable |
propagateClose(LoggingAdvisingAppendable delegate,
com.google.common.collect.ImmutableList<Closeable> closeables)
Returns a
LoggingAdvisingAppendable that:
Forwards all LoggingAdvisingAppendable methods to delegate
Implements Closeable and forwards all Closeable.close() calls to the given
closeables in order. |
static int |
rangeLoopLength(int start,
int end,
int step) |
static void |
renderSoyMsgPartsWithPlaceholders(com.google.common.collect.ImmutableList<SoyMsgPart> msgParts,
com.ibm.icu.util.ULocale locale,
Map<String,Object> placeholders,
Appendable out)
Render a 'complex' message containing with placeholders.
|
static SoyValue |
resolveSoyValueProvider(SoyValueProvider provider)
Helper function to translate NullData -> null when resolving a SoyValueProvider.
|
static boolean |
stringEqualsAsNumber(String expr,
double number) |
static AssertionError |
unexpectedStateError(int state) |
public static final SoyValueProvider NULL_PROVIDER
public static AssertionError unexpectedStateError(int state)
public static boolean stringEqualsAsNumber(String expr, double number)
public static SoyValue resolveSoyValueProvider(SoyValueProvider provider)
public static SoyValueProvider getFieldProvider(SoyRecord record, String field)
NULL_PROVIDER for missing fields.public static SoyValue callSoyFunction(SoyJavaFunction function, List<SoyValue> args)
In the long run we should either fix ToFu (and all SoyJavaFunctions) to not use NullData or we should introduce custom SoyFunction implementations for have come from SoyValueProvider.
public static SoyValue applyPrintDirective(SoyJavaPrintDirective directive, SoyValue value, List<SoyValue> args)
public static CompiledTemplate applyEscapers(CompiledTemplate delegate, com.google.common.collect.ImmutableList<SoyJavaPrintDirective> directives)
delegate - The delegate template to renderdirectives - The set of directives to applypublic static SoyValueProvider getSoyListItem(List<SoyValueProvider> list, long index)
public static RenderResult getListStatus(List<? extends SoyValueProvider> soyValueProviders)
public static RenderResult getMapStatus(Map<String,? extends SoyValueProvider> soyValueProviders)
public static SoyValueProvider getSoyMapItem(SoyMap soyMap, SoyValue key)
public static SoyValueProvider getSoyLegacyObjectMapItem(SoyLegacyObjectMap legacyObjectMap, SoyValue key)
public static void renderSoyMsgPartsWithPlaceholders(com.google.common.collect.ImmutableList<SoyMsgPart> msgParts, @Nullable com.ibm.icu.util.ULocale locale, Map<String,Object> placeholders, Appendable out) throws IOException
IOExceptionpublic static boolean compareNullableString(@Nullable String string, SoyValue other)
public static LoggingAdvisingAppendable logger()
public static int rangeLoopLength(int start,
int end,
int step)
public static boolean coerceToBoolean(double v)
public static com.google.template.soy.jbcsrc.runtime.JbcSrcRuntime.ClosePropagatingAppendable propagateClose(LoggingAdvisingAppendable delegate, com.google.common.collect.ImmutableList<Closeable> closeables)
LoggingAdvisingAppendable that:
LoggingAdvisingAppendable methods to delegate
Closeable and forwards all Closeable.close() calls to the given
closeables in order.
This strategy allows us to make certain directives closeable without requiring them all to be since this wrapper can propagate the close signals in the rare case that a closeable directive is wrapped with a non closeable one (or multiple closeable wrappers are composed)