org.thymeleaf.context
Class AbstractProcessingContext

Object
  extended by org.thymeleaf.context.AbstractProcessingContext
All Implemented Interfaces:
IProcessingContext
Direct Known Subclasses:
AbstractDialectAwareProcessingContext, ProcessingContext

public abstract class AbstractProcessingContext
extends Object
implements IProcessingContext

Since:
2.0.9
Author:
Daniel Fernández

Field Summary
protected static String EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME
           
 
Constructor Summary
protected AbstractProcessingContext(IContext context)
           
protected AbstractProcessingContext(IContext context, Map<String,Object> localVariables)
           
protected AbstractProcessingContext(IContext context, Map<String,Object> localVariables, Object selectionTarget, boolean selectionTargetSet)
           
 
Method Summary
protected  Map<String,Object> computeExpressionObjects()
           
 Map<String,Object> getBaseContextVariables()
          Deprecated. Use getExpressionObjects() instead. Will be removed in 2.1.x
 IContext getContext()
           Returns the current context specified for template processing.
 Object getExpressionEvaluationRoot()
           Returns the current evaluation root.
 Map<String,Object> getExpressionObjects()
           Returns the map of expression objects that should be made available to every expression evaluation operation (whenever variable evaluation is available).
 Object getExpressionSelectionEvaluationRoot()
           Returns the current selection evaluation root.
 Object getLocalVariable(String variableName)
           Returns the value of a local variable.
 Map<String,Object> getLocalVariables()
           Returns the map of local variables.
 Object getSelectionTarget()
           Returns the selection target object, and raises an exception if there isn't any.
 boolean hasLocalVariable(String variableName)
           Returns whether a specific local variable is defined or not.
 boolean hasLocalVariables()
           Returns whether local variables have currently been specified or not.
 boolean hasSelectionTarget()
           Returns whether there currently is a selection going on (e.g.
protected  Map<String,Object> mergeNewLocalVariables(Map<String,Object> newVariables)
           
 HashMap<String,Object> unsafeGetLocalVariables()
          Deprecated. Use getLocalVariables() instead. Will be removed in 2.1.x.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME

protected static final String EVAL_SELECTION_TARGET_LOCAL_VARIABLE_NAME
See Also:
Constant Field Values
Constructor Detail

AbstractProcessingContext

protected AbstractProcessingContext(IContext context)

AbstractProcessingContext

protected AbstractProcessingContext(IContext context,
                                    Map<String,Object> localVariables)

AbstractProcessingContext

protected AbstractProcessingContext(IContext context,
                                    Map<String,Object> localVariables,
                                    Object selectionTarget,
                                    boolean selectionTargetSet)
Method Detail

computeExpressionObjects

protected Map<String,Object> computeExpressionObjects()

getBaseContextVariables

@Deprecated
public Map<String,Object> getBaseContextVariables()
Deprecated. Use getExpressionObjects() instead. Will be removed in 2.1.x

Description copied from interface: IProcessingContext

Returns the map of base variables that should be made available to every expression evaluation operation (whenever variable evaluation is available).

Specified by:
getBaseContextVariables in interface IProcessingContext
Returns:
the map of variables (a new object, mutable, safe to use as a context variables base)

getExpressionObjects

public Map<String,Object> getExpressionObjects()
Description copied from interface: IProcessingContext

Returns the map of expression objects that should be made available to every expression evaluation operation (whenever variable evaluation is available). In OGNL and SpringEL expressions, these will be available as #object1, #object2, etc.

Specified by:
getExpressionObjects in interface IProcessingContext
Returns:
the map of objects

getContext

public IContext getContext()
Description copied from interface: IProcessingContext

Returns the current context specified for template processing.

Specified by:
getContext in interface IProcessingContext
Returns:
the current context

getExpressionEvaluationRoot

public Object getExpressionEvaluationRoot()
Description copied from interface: IProcessingContext

Returns the current evaluation root. This is the object on which expressions (normal expressions, like those specified in the standard dialect with ${...}) are executed.

Specified by:
getExpressionEvaluationRoot in interface IProcessingContext
Returns:
the expression evaluation root

getExpressionSelectionEvaluationRoot

public Object getExpressionSelectionEvaluationRoot()
Description copied from interface: IProcessingContext

Returns the current selection evaluation root. This is the object on which selection expressions (like those specified in the standard dialect with *{...}) are executed.

Specified by:
getExpressionSelectionEvaluationRoot in interface IProcessingContext
Returns:
the selection evaluation root

hasSelectionTarget

public boolean hasSelectionTarget()
Description copied from interface: IProcessingContext

Returns whether there currently is a selection going on (e.g. th:object in standard dialect).

Specified by:
hasSelectionTarget in interface IProcessingContext
Returns:
true if there is a selection currently established, false if not

getSelectionTarget

public Object getSelectionTarget()
Description copied from interface: IProcessingContext

Returns the selection target object, and raises an exception if there isn't any.

Meant for internal use.

Specified by:
getSelectionTarget in interface IProcessingContext
Returns:
the selection target object

hasLocalVariables

public boolean hasLocalVariables()
Description copied from interface: IProcessingContext

Returns whether local variables have currently been specified or not. (e.g. th:with in standard dialect).

Specified by:
hasLocalVariables in interface IProcessingContext
Returns:
true if there are local variables, false if not

hasLocalVariable

public boolean hasLocalVariable(String variableName)
Description copied from interface: IProcessingContext

Returns whether a specific local variable is defined or not.

Specified by:
hasLocalVariable in interface IProcessingContext
Returns:
true if the variable is currently defined, false if not.

getLocalVariable

public Object getLocalVariable(String variableName)
Description copied from interface: IProcessingContext

Returns the value of a local variable.

Specified by:
getLocalVariable in interface IProcessingContext
Parameters:
variableName - the name of the local variable to be returned
Returns:
the value of the variable, or null if the variable does not exist (or has null value)

getLocalVariables

public Map<String,Object> getLocalVariables()
Description copied from interface: IProcessingContext

Returns the map of local variables.

Specified by:
getLocalVariables in interface IProcessingContext
Returns:
the local variables

unsafeGetLocalVariables

@Deprecated
public HashMap<String,Object> unsafeGetLocalVariables()
Deprecated. Use getLocalVariables() instead. Will be removed in 2.1.x.

Returns the real inner map of local variables. This method should not be called directly.

Returns:
the local variables map, which could be null if no variables are defined

mergeNewLocalVariables

protected Map<String,Object> mergeNewLocalVariables(Map<String,Object> newVariables)


Copyright © 2013 The THYMELEAF team. All Rights Reserved.