public class VariableValue extends Value
null
if there is no Data object associated with the given name.Constructor and Description |
---|
VariableValue(String name,
DataContext dataContext) |
Modifier and Type | Method and Description |
---|---|
boolean |
asBoolean()
Fetch value as boolean.
|
int |
asNumber()
Fetch value as number.
|
String |
asString()
Fetch value as string.
|
boolean |
exists()
Whether this value exists.
|
EscapeMode |
getEscapeMode()
Indicates the escaping that was applied to the expression represented by this value.
|
String |
getName() |
Data |
getReference() |
boolean |
isEmpty() |
String |
toString() |
protected String |
value() |
equals, hashCode, isPartiallyEscaped, literalConstant, literalConstant, literalConstant, literalValue, literalValue, literalValue, variableValue
public VariableValue(String name, DataContext dataContext)
public String getName()
public Data getReference()
protected String value()
public boolean exists()
Value
public EscapeMode getEscapeMode()
Value
May be checked by the JSilver code before applying autoescaping. It differs from isEscaped
, which is true iff any part of the variable expression contains an escaping
function, even if the entire expression has not been escaped. Both methods are required,
isEscaped
to determine whether <?cs escape > commands should be applied, and
getEscapeMode
for autoescaping. This is done to maintain compatibility with
ClearSilver's behaviour.
getEscapeMode
in class Value
EscapeMode.ESCAPE_IS_CONSTANT
if the value represents a constant string
literal. Or the appropriate EscapeMode
if the value is the output of an
escaping function.EscapeMode
public boolean asBoolean()
Value
public int asNumber()
Value
Copyright © 2010–2016 Google. All rights reserved.