public class Context
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Context.Builder
A context builder.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
INLINE_PARTIALS
Inline partials.
|
static java.lang.String |
INVOCATION_STACK
The qualified name for partials.
|
static java.lang.String |
PARAM_SIZE
Number of parameters of a helper.
|
static java.lang.String |
PARTIALS
The qualified name for partials.
|
Modifier and Type | Method and Description |
---|---|
Context |
combine(java.util.Map<java.lang.String,?> model)
Insert all the attributes in the context-stack.
|
Context |
combine(java.lang.String name,
java.lang.Object model)
Insert a new attribute in the context-stack.
|
static Context |
copy(Context context,
java.lang.Object model)
Creates a new context but keep the
data attribute. |
Context |
data(java.util.Map<java.lang.String,?> attributes)
Store the map in the data storage.
|
<T> T |
data(java.lang.String name)
Read the attribute from the data storage.
|
Context |
data(java.lang.String name,
java.lang.Object value)
Set an attribute in the data storage.
|
void |
destroy()
Destroy this context by cleaning up instance attributes.
|
java.lang.Object |
get(java.util.List<PathExpression> path)
Lookup the given key inside the context stack.
|
java.lang.Object |
get(java.lang.String key)
Lookup the given key inside the context stack.
|
java.lang.Object |
get(java.lang.String key,
boolean parentScopeResolution)
Lookup the given key inside the context stack.
|
boolean |
isBlockParams() |
java.lang.Object |
model()
Resolved as '.' or 'this' inside templates.
|
static Context |
newBlockParamContext(Context parent,
java.util.List<java.lang.String> names,
java.util.List<java.lang.Object> values)
Creates a new block param context.
|
static Context.Builder |
newBuilder(Context parent,
java.lang.Object model)
Start a new context builder.
|
static Context.Builder |
newBuilder(java.lang.Object model)
Start a new context builder.
|
static Context |
newContext(Context parent,
java.lang.Object model)
Creates a new child context.
|
static Context |
newContext(java.lang.Object model)
Creates a new root context.
|
static Context |
newPartialContext(Context ctx,
java.lang.String scope,
java.util.Map<java.lang.String,java.lang.Object> hash)
Creates a new partial context.
|
Context |
parent()
The parent context or null.
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
propertySet()
List all the properties and values of
model() . |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
propertySet(java.lang.Object context)
List all the properties and values for the given object.
|
java.lang.String |
toString() |
public static final java.lang.String PARTIALS
public static final java.lang.String INLINE_PARTIALS
public static final java.lang.String INVOCATION_STACK
public static final java.lang.String PARAM_SIZE
public Context combine(java.lang.String name, java.lang.Object model)
name
- The attribute's name. Required.model
- The model data.public Context combine(java.util.Map<java.lang.String,?> model)
model
- The model attributes.public <T> T data(java.lang.String name)
T
- Data type.name
- The attribute's name.public Context data(java.lang.String name, java.lang.Object value)
name
- The attribute's name. Required.value
- The attribute's value. Required.public Context data(java.util.Map<java.lang.String,?> attributes)
attributes
- The attributes to add. Required.public final java.lang.Object model()
public final Context parent()
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> propertySet(java.lang.Object context)
context
- The context object.public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> propertySet()
model()
.model()
.public boolean isBlockParams()
public java.lang.Object get(java.util.List<PathExpression> path)
path
- The object path.null
if no value is found.public java.lang.Object get(java.lang.String key)
key
- The object key.null
if no value is found.public java.lang.Object get(java.lang.String key, boolean parentScopeResolution)
key
- The object key.parentScopeResolution
- False, if we want to restrict lookup to current scope.null
if no value is found.public void destroy()
public java.lang.String toString()
toString
in class java.lang.Object
public static Context.Builder newBuilder(Context parent, java.lang.Object model)
parent
- The parent context. Required.model
- The model data.public static Context.Builder newBuilder(java.lang.Object model)
model
- The model data.public static Context newContext(Context parent, java.lang.Object model)
parent
- The parent context. Required.model
- The model data.public static Context newBlockParamContext(Context parent, java.util.List<java.lang.String> names, java.util.List<java.lang.Object> values)
parent
- The parent context. Required.names
- A list of names to set in the block param context.values
- A list of values to set in the block param context.public static Context newPartialContext(Context ctx, java.lang.String scope, java.util.Map<java.lang.String,java.lang.Object> hash)
ctx
- Current scope.scope
- Scope switch.hash
- Partial hash.public static Context newContext(java.lang.Object model)
model
- The model data.Copyright © 2010 - 2020 Adobe. All Rights Reserved