com.google.clearsilver.jsilver.autoescape
Enum EscapeMode

java.lang.Object
  extended by java.lang.Enum<EscapeMode>
      extended by com.google.clearsilver.jsilver.autoescape.EscapeMode
All Implemented Interfaces:
Serializable, Comparable<EscapeMode>

public enum EscapeMode
extends Enum<EscapeMode>


Enum Constant Summary
ESCAPE_AUTO
           
ESCAPE_AUTO_ATTR
           
ESCAPE_AUTO_ATTR_CSS
           
ESCAPE_AUTO_ATTR_JS
           
ESCAPE_AUTO_ATTR_UNQUOTED_JS
           
ESCAPE_AUTO_ATTR_URI
           
ESCAPE_AUTO_ATTR_URI_START
           
ESCAPE_AUTO_HTML
           
ESCAPE_AUTO_JS
           
ESCAPE_AUTO_JS_UNQUOTED
           
ESCAPE_AUTO_STYLE
           
ESCAPE_AUTO_UNQUOTED_ATTR
           
ESCAPE_AUTO_UNQUOTED_ATTR_CSS
           
ESCAPE_AUTO_UNQUOTED_ATTR_JS
           
ESCAPE_AUTO_UNQUOTED_ATTR_UNQUOTED_JS
           
ESCAPE_AUTO_UNQUOTED_ATTR_URI
           
ESCAPE_AUTO_UNQUOTED_ATTR_URI_START
           
ESCAPE_HTML
           
ESCAPE_IS_CONSTANT
           
ESCAPE_JS
           
ESCAPE_NONE
           
ESCAPE_URL
           
 
Method Summary
static EscapeMode combineModes(EscapeMode left, EscapeMode right)
          Computes the EscapeMode of the result of concatenating two values.
static EscapeMode computeEscapeMode(String escapeCmd)
          Calls computeEscapeMode(String, boolean) with doAutoEscape = false.
static EscapeMode computeEscapeMode(String escapeCmd, boolean doAutoEscape)
          This function maps the type of escaping requested (escapeCmd) to the appropriate EscapeMode.
 String getEscapeCommand()
           
 boolean isAutoEscapingMode()
           
static EscapeMode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static EscapeMode[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ESCAPE_NONE

public static final EscapeMode ESCAPE_NONE

ESCAPE_HTML

public static final EscapeMode ESCAPE_HTML

ESCAPE_JS

public static final EscapeMode ESCAPE_JS

ESCAPE_URL

public static final EscapeMode ESCAPE_URL

ESCAPE_IS_CONSTANT

public static final EscapeMode ESCAPE_IS_CONSTANT

ESCAPE_AUTO

public static final EscapeMode ESCAPE_AUTO

ESCAPE_AUTO_HTML

public static final EscapeMode ESCAPE_AUTO_HTML

ESCAPE_AUTO_JS

public static final EscapeMode ESCAPE_AUTO_JS

ESCAPE_AUTO_JS_UNQUOTED

public static final EscapeMode ESCAPE_AUTO_JS_UNQUOTED

ESCAPE_AUTO_STYLE

public static final EscapeMode ESCAPE_AUTO_STYLE

ESCAPE_AUTO_ATTR

public static final EscapeMode ESCAPE_AUTO_ATTR

ESCAPE_AUTO_UNQUOTED_ATTR

public static final EscapeMode ESCAPE_AUTO_UNQUOTED_ATTR

ESCAPE_AUTO_ATTR_URI

public static final EscapeMode ESCAPE_AUTO_ATTR_URI

ESCAPE_AUTO_UNQUOTED_ATTR_URI

public static final EscapeMode ESCAPE_AUTO_UNQUOTED_ATTR_URI

ESCAPE_AUTO_ATTR_URI_START

public static final EscapeMode ESCAPE_AUTO_ATTR_URI_START

ESCAPE_AUTO_UNQUOTED_ATTR_URI_START

public static final EscapeMode ESCAPE_AUTO_UNQUOTED_ATTR_URI_START

ESCAPE_AUTO_ATTR_JS

public static final EscapeMode ESCAPE_AUTO_ATTR_JS

ESCAPE_AUTO_ATTR_UNQUOTED_JS

public static final EscapeMode ESCAPE_AUTO_ATTR_UNQUOTED_JS

ESCAPE_AUTO_UNQUOTED_ATTR_JS

public static final EscapeMode ESCAPE_AUTO_UNQUOTED_ATTR_JS

ESCAPE_AUTO_UNQUOTED_ATTR_UNQUOTED_JS

public static final EscapeMode ESCAPE_AUTO_UNQUOTED_ATTR_UNQUOTED_JS

ESCAPE_AUTO_ATTR_CSS

public static final EscapeMode ESCAPE_AUTO_ATTR_CSS

ESCAPE_AUTO_UNQUOTED_ATTR_CSS

public static final EscapeMode ESCAPE_AUTO_UNQUOTED_ATTR_CSS
Method Detail

values

public static EscapeMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (EscapeMode c : EscapeMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static EscapeMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

computeEscapeMode

public static EscapeMode computeEscapeMode(String escapeCmd,
                                           boolean doAutoEscape)
This function maps the type of escaping requested (escapeCmd) to the appropriate EscapeMode. If no explicit escaping is requested, but doAutoEscape is true, the function chooses auto escaping (EscapeMode.ESCAPE_AUTO). This mirrors the behaviour of ClearSilver.

Parameters:
escapeCmd - A string indicating type of escaping requested.
doAutoEscape - Whether auto escaping should be applied if escapeCmd is null. Corresponds to the Config.AutoEscape HDF variable.
Returns:

computeEscapeMode

public static EscapeMode computeEscapeMode(String escapeCmd)
Calls computeEscapeMode(String, boolean) with doAutoEscape = false.

Parameters:
escapeCmd - A string indicating type of escaping requested.
Returns:
EscapeMode
Throws:
JSilverAutoEscapingException - if escapeCmd is not recognized.

combineModes

public static EscapeMode combineModes(EscapeMode left,
                                      EscapeMode right)
Computes the EscapeMode of the result of concatenating two values. The EscapeModes of the two values are provided by left and right respectively. For now, if either of the values was escaped or a constant, we return ESCAPE_IS_CONSTANT. This is how ClearSilver behaves.

Returns:
ESCAPE_NONE if either of the values was not escaped or constant. ESCAPE_IS_CONSTANT otherwise.

isAutoEscapingMode

public boolean isAutoEscapingMode()

getEscapeCommand

public String getEscapeCommand()


Copyright © 2010-2012 Google. All Rights Reserved.