|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.github.jknack.handlebars.Context
public final class Context
Mustache/Handlebars are contextual template engines. This class represent the 'context stack' of a template.
| Nested Class Summary | |
|---|---|
static class |
Context.Builder
A context builder. |
| Field Summary | |
|---|---|
static String |
PARTIALS
The qualified name for partials. |
| Method Summary | ||
|---|---|---|
|
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. |
|
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()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String PARTIALS
| Method Detail |
|---|
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 Object model()
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 String toString()
toString in class Object
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.
public static Context newContext(Object model)
model - The model data.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||