Package com.github.jknack.handlebars
Class Context
java.lang.Object
com.github.jknack.handlebars.Context
Deprecated.
com.github.jknack.handlebars package is deprecated and marked for removal in subsequent releases which will involve removal of the handlebars dependency in AEM.
Mustache/Handlebars are contextual template engines. This class represent the
'context stack' of a template.
- Objects and hashes should be pushed onto the context stack.
- All elements on the context stack should be accessible.
- Multiple sections per template should be permitted.
- Failed context lookups should be considered falsy.
- Dotted names should be valid for Section tags.
- Dotted names that cannot be resolved should be considered falsy.
- Dotted Names - Context Precedence: Dotted names should be resolved against former resolutions.
- Since:
- 0.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDeprecated.com.github.jknack.handlebars package is deprecated and marked for removal in subsequent releases which will involve removal of the handlebars dependency in AEM. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.Last callee of a partial block.static final StringDeprecated.Inline partials.static final StringDeprecated.The qualified name for partials.static final StringDeprecated.Number of parameters of a helper.static final StringDeprecated.The qualified name for partials. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Insert a new attribute in the context-stack.Deprecated.Insert all the attributes in the context-stack.static ContextDeprecated.Creates a new context but keep thedataattribute.<T> TDeprecated.Read the attribute from the data storage.Deprecated.Set an attribute in the data storage.Deprecated.Store the map in the data storage.voiddestroy()Deprecated.Destroy this context by cleaning up instance attributes.Deprecated.Lookup the given key inside the context stack.Deprecated.Lookup the given key inside the context stack.get(List<PathExpression> path) Deprecated.Lookup the given key inside the context stack.booleanDeprecated.final Objectmodel()Deprecated.Resolved as '.' or 'this' inside templates.static ContextDeprecated.Creates a new block param context.static Context.BuildernewBuilder(Context parent, Object model) Deprecated.Start a new context builder.static Context.BuildernewBuilder(Object model) Deprecated.Start a new context builder.static ContextnewContext(Context parent, Object model) Deprecated.Creates a new child context.static ContextnewContext(Object model) Deprecated.Creates a new root context.static ContextDeprecated.Creates a new partial context.final Contextparent()Deprecated.The parent context or null.Deprecated.List all the properties and values ofmodel().propertySet(Object context) Deprecated.List all the properties and values for the given object.toString()Deprecated.
-
Field Details
-
PARTIALS
Deprecated.The qualified name for partials. Internal use. -
INLINE_PARTIALS
Deprecated.Inline partials.- See Also:
-
INVOCATION_STACK
Deprecated.The qualified name for partials. Internal use. -
PARAM_SIZE
Deprecated.Number of parameters of a helper. Internal use. -
CALLEE
Deprecated.Last callee of a partial block. Internal use.
-
-
Method Details
-
combine
Deprecated.Insert a new attribute in the context-stack.- Parameters:
name- The attribute's name. Required.model- The model data.- Returns:
- This context.
-
combine
Deprecated.Insert all the attributes in the context-stack.- Parameters:
model- The model attributes.- Returns:
- This context.
-
data
Deprecated.Read the attribute from the data storage.- Type Parameters:
T- Data type.- Parameters:
name- The attribute's name.- Returns:
- The attribute value or null.
-
data
Deprecated.Set an attribute in the data storage.- Parameters:
name- The attribute's name. Required.value- The attribute's value. Required.- Returns:
- This context.
-
data
Deprecated.Store the map in the data storage.- Parameters:
attributes- The attributes to add. Required.- Returns:
- This context.
-
model
Deprecated.Resolved as '.' or 'this' inside templates.- Returns:
- The model or data.
-
parent
Deprecated.The parent context or null.- Returns:
- The parent context or null.
-
propertySet
Deprecated.List all the properties and values for the given object.- Parameters:
context- The context object.- Returns:
- All the properties and values for the given object.
-
propertySet
Deprecated.List all the properties and values ofmodel().- Returns:
- All the properties and values of
model().
-
isBlockParams
public boolean isBlockParams()Deprecated.- Returns:
- True, if this context is a block param context.
-
get
Deprecated.Lookup the given key inside the context stack.- Objects and hashes should be pushed onto the context stack.
- All elements on the context stack should be accessible.
- Multiple sections per template should be permitted.
- Failed context lookups should be considered falsey.
- Dotted names should be valid for Section tags.
- Dotted names that cannot be resolved should be considered falsey.
- Dotted Names - Context Precedence: Dotted names should be resolved against former resolutions.
- Parameters:
path- The object path.- Returns:
- The value associated to the given key or
nullif no value is found.
-
get
Deprecated.Lookup the given key inside the context stack.- Objects and hashes should be pushed onto the context stack.
- All elements on the context stack should be accessible.
- Multiple sections per template should be permitted.
- Failed context lookups should be considered falsey.
- Dotted names should be valid for Section tags.
- Dotted names that cannot be resolved should be considered falsey.
- Dotted Names - Context Precedence: Dotted names should be resolved against former resolutions.
- Parameters:
key- The object key.- Returns:
- The value associated to the given key or
nullif no value is found.
-
get
Deprecated.Lookup the given key inside the context stack.- Objects and hashes should be pushed onto the context stack.
- All elements on the context stack should be accessible.
- Multiple sections per template should be permitted.
- Failed context lookups should be considered falsey.
- Dotted names should be valid for Section tags.
- Dotted names that cannot be resolved should be considered falsey.
- Dotted Names - Context Precedence: Dotted names should be resolved against former resolutions.
- Parameters:
key- The object key.parentScopeResolution- False, if we want to restrict lookup to current scope.- Returns:
- The value associated to the given key or
nullif no value is found.
-
destroy
public void destroy()Deprecated.Destroy this context by cleaning up instance attributes. -
toString
Deprecated. -
newBuilder
Deprecated.Start a new context builder.- Parameters:
parent- The parent context. Required.model- The model data.- Returns:
- A new context builder.
-
newBuilder
Deprecated.Start a new context builder.- Parameters:
model- The model data.- Returns:
- A new context builder.
-
newContext
Deprecated.Creates a new child context.- Parameters:
parent- The parent context. Required.model- The model data.- Returns:
- A new child context.
-
newBlockParamContext
Deprecated.Creates a new block param context.- Parameters:
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.- Returns:
- A new block param context.
-
newPartialContext
Deprecated.Creates a new partial context.- Parameters:
ctx- Current scope.scope- Scope switch.hash- Partial hash.- Returns:
- A new context.
-
newContext
Deprecated.Creates a new root context.- Parameters:
model- The model data.- Returns:
- A new root context.
-
copy
Deprecated.Creates a new context but keep thedataattribute.- Parameters:
context- Context to extract thedataattribute.model- A model/data.- Returns:
- A new context.
-