public class Context extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Context.Builder
A context builder.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
INVOCATION_STACK
The qualified name for partials.
|
static String |
PARAM_SIZE
Number of parameters of a helper.
|
static String |
PARTIALS
The qualified name for partials.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Context(Object model)
Creates a new context.
|
| Modifier and Type | Method and Description |
|---|---|
Context |
data(Map<String,?> attributes)
Store the map in the data storage.
|
<T> T |
data(String name)
Read the attribute from the data storage.
|
Context |
data(String name,
Object value)
Set an attribute in the data storage.
|
void |
destroy()
Destroy this context by cleaning up instance attributes.
|
Object |
get(String key)
Lookup the given key inside the context stack.
|
Object |
model()
Resolved as '.' or 'this' inside templates.
|
static Context.Builder |
newBuilder(Context parent,
Object model)
Start a new context builder.
|
static Context.Builder |
newBuilder(Object model)
Start a new context builder.
|
static Context |
newContext(Context parent,
Object model)
Creates a new child context.
|
static Context |
newContext(Object model)
Creates a new root context.
|
Context |
parent()
The parent context or null.
|
Set<Map.Entry<String,Object>> |
propertySet()
List all the properties and values of
model(). |
Set<Map.Entry<String,Object>> |
propertySet(Object context)
List all the properties and values for the given object.
|
String |
toString() |
public static final String PARTIALS
public static final String INVOCATION_STACK
public static final String PARAM_SIZE
protected Context(Object model)
model - The target value. Resolved as '.' or 'this' inside
templates. Required.public <T> T data(String name)
T - Data type.name - The attribute's name.public Context data(String name, Object value)
name - The attribute's name. Required.value - The attribute's value. Required.public Context data(Map<String,?> attributes)
attributes - The attributes to add. Required.public Object model()
public Context parent()
public Set<Map.Entry<String,Object>> propertySet(Object context)
context - The context object.public Set<Map.Entry<String,Object>> propertySet()
model().model().public Object get(String key)
key - The object key.null if no
value is found.public void destroy()
public static Context.Builder newBuilder(Context parent, Object model)
parent - The parent context. Required.model - The model data.public static Context.Builder newBuilder(Object model)
model - The model data.public static Context newContext(Context parent, Object model)
parent - The parent context. Required.model - The model data.Copyright © 2015. All rights reserved.