public interface DataContext
Modifier and Type | Method and Description |
---|---|
void |
createLocalVariableByPath(String name,
String path)
Creates a local variable that references a (possibly non-existent) Data node.
|
void |
createLocalVariableByValue(String name,
String value)
Creates and sets a local variable in the current scope equal to the given value.
|
void |
createLocalVariableByValue(String name,
String value,
boolean isFirst,
boolean isLast)
Creates and sets a local variable in the current scope equal to the given value.
|
void |
createLocalVariableByValue(String name,
String value,
EscapeMode mode)
Creates and sets a local variable in the current scope equal to the given value.
|
Data |
findVariable(String name,
boolean create)
Searches the variable map stack for the specified variable name.
|
EscapeMode |
findVariableEscapeMode(String name)
Searches the variable map stack for the specified variable name, and returns its
EscapeMode . |
Data |
getRootData()
Returns the main Data object this RenderingContext was defined with.
|
void |
popVariableScope()
Removes the most recent Data object added to the local variable map stack.
|
void |
pushVariableScope()
Creates a new Data object to hold local references, pushes it onto the variable map stack.
|
Data getRootData()
void pushVariableScope()
void popVariableScope()
void createLocalVariableByValue(String name, String value)
name
- the name of the local variable to fetch or create.value
- The String value to store at the local variable.void createLocalVariableByValue(String name, String value, EscapeMode mode)
name
- the name of the local variable to fetch or create.value
- The String value to store at the local variable.mode
- EscapeMode that describes the escaping this variable has. EscapeMode.ESCAPE_NONE
if the variable was not escaped. EscapeMode.ESCAPE_IS_CONSTANT
if the variable was populated with a string or numeric
literal.void createLocalVariableByValue(String name, String value, boolean isFirst, boolean isLast)
This method is a helper method for supporting the first() and last() functions on loops without requiring loops create a full Data tree.
name
- the name of the local variable to fetch or create.value
- The String value to store at the local variable.isFirst
- What the local variable should return for
Data.isFirstSibling()
isLast
- What the local variable should return for
Data.isLastSibling()
void createLocalVariableByPath(String name, String path)
null
, if it does not exist. If findVariable(java.lang.String, boolean)
is called with create ==
true
, then if no Data object exists at the path location, it will be created.name
- the name of the local variable to fetch or create.path
- The path to the Data objectData findVariable(String name, boolean create)
true
, then a new node is created
with the given name in the root Data object and that node is returned.
Note: This only creates nodes in the root Data object, not in any local variable map. To do
that, use the Data node returned by pushVariableScope()
.
name
- the name of the variable to find and/or create.create
- if true
then a new node will be created if an existing Data node with the
given name does not exist.null
if no such node
exists and create
is false
.EscapeMode findVariableEscapeMode(String name)
EscapeMode
.EscapeMode
, otherwise returns EscapeMode.ESCAPE_NONE
.Copyright © 2010-2014 Google. All Rights Reserved.