com.google.template.soy.coredirectives
Class EscapeHtmlDirective

java.lang.Object
  extended by com.google.template.soy.tofu.restricted.SoyAbstractTofuPrintDirective
      extended by com.google.template.soy.coredirectives.EscapeHtmlDirective
All Implemented Interfaces:
SoyJavaSrcPrintDirective, SoyJsSrcPrintDirective, SoyJavaRuntimePrintDirective, SoyPrintDirective, SoyTofuPrintDirective

public class EscapeHtmlDirective
extends SoyAbstractTofuPrintDirective
implements SoyJsSrcPrintDirective, SoyJavaSrcPrintDirective

A directive that HTML-escapes the output.


Field Summary
static String NAME
           
 
Constructor Summary
EscapeHtmlDirective()
           
 
Method Summary
 SoyData apply(SoyData value, List<SoyData> args)
          Applies this directive on the given value.
 JavaExpr applyForJavaSrc(JavaExpr value, List<JavaExpr> args)
          Applies this directive on the given string value.
 JsExpr applyForJsSrc(JsExpr value, List<JsExpr> args)
          Applies this directive on the given string value.
 String getName()
          Gets the name of the Soy print directive.
 Set<Integer> getValidArgsSizes()
          Gets the set of valid args list sizes.
 boolean shouldCancelAutoescape()
          Returns whether the appearance of this directive on a 'print' tag should cancel autoescape for that 'print' tag.
 
Methods inherited from class com.google.template.soy.tofu.restricted.SoyAbstractTofuPrintDirective
applyForTofu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values
Constructor Detail

EscapeHtmlDirective

@Inject
public EscapeHtmlDirective()
Method Detail

getName

public String getName()
Description copied from interface: SoyPrintDirective
Gets the name of the Soy print directive.

Specified by:
getName in interface SoyPrintDirective
Returns:
The name of the Soy print directive.

getValidArgsSizes

public Set<Integer> getValidArgsSizes()
Description copied from interface: SoyPrintDirective
Gets the set of valid args list sizes. For example, the set {0, 2} would indicate that this directive can take 0 or 2 arguments (but not 1).

Specified by:
getValidArgsSizes in interface SoyPrintDirective
Returns:
The set of valid args list sizes.

shouldCancelAutoescape

public boolean shouldCancelAutoescape()
Description copied from interface: SoyPrintDirective
Returns whether the appearance of this directive on a 'print' tag should cancel autoescape for that 'print' tag.

Specified by:
shouldCancelAutoescape in interface SoyPrintDirective
Returns:
Whether the appearance of this directive on a 'print' tag should cancel autoescape for that 'print' tag.

apply

public SoyData apply(SoyData value,
                     List<SoyData> args)
Description copied from interface: SoyJavaRuntimePrintDirective
Applies this directive on the given value.

Specified by:
apply in interface SoyJavaRuntimePrintDirective
Parameters:
value - The input to the directive. This may have not yet been coerced to a string.
args - The directive's arguments, if any (usually none).
Returns:
The resulting value.

applyForJsSrc

public JsExpr applyForJsSrc(JsExpr value,
                            List<JsExpr> args)
Description copied from interface: SoyJsSrcPrintDirective
Applies this directive on the given string value.

Important note when implementing this method: The string value may not yet have been coerced to a string. You may need to explicitly coerce it to a string using the JS function String().

Specified by:
applyForJsSrc in interface SoyJsSrcPrintDirective
Parameters:
value - The value to apply the directive on. This value may not yet have been coerced to a string.
args - The directive's arguments, if any (usually none).
Returns:
The resulting value.

applyForJavaSrc

public JavaExpr applyForJavaSrc(JavaExpr value,
                                List<JavaExpr> args)
Description copied from interface: SoyJavaSrcPrintDirective
Applies this directive on the given string value.

Specified by:
applyForJavaSrc in interface SoyJavaSrcPrintDirective
Parameters:
value - The value to apply the directive on. This value may not yet have been coerced to a string.
args - The directive's arguments, if any (usually none).
Returns:
The resulting value.