use of com.google.template.soy.jbcsrc.restricted.SoyExpression in project closure-templates by google.
the class BasicEscapeDirective method applyForJbcSrcStreaming.
/**
* Default implementation for {@link Streamable}.
*
* <p>Subclasses can simply add {@code implements Streamable} if they have an implementation in
* Sanitizers.<name>Streaming. If they don't, this method will throw while trying to find it.
*/
public final AppendableAndOptions applyForJbcSrcStreaming(JbcSrcPluginContext context, Expression delegateAppendable, List<SoyExpression> args) {
MethodRef sanitizerMethod = javaStreamingSanitizer;
if (sanitizerMethod == null) {
// lazily allocated
sanitizerMethod = MethodRef.create(Sanitizers.class, name.substring(1) + "Streaming", LoggingAdvisingAppendable.class).asNonNullable();
javaStreamingSanitizer = sanitizerMethod;
}
Expression streamingSanitizersExpr = sanitizerMethod.invoke(delegateAppendable);
if (isCloseable()) {
return AppendableAndOptions.createCloseable(streamingSanitizersExpr);
} else {
return AppendableAndOptions.create(streamingSanitizersExpr);
}
}
Aggregations