org.apache.oozie.util
Class ELEvaluator.Context

java.lang.Object
  extended by org.apache.oozie.util.ELEvaluator.Context
All Implemented Interfaces:
javax.servlet.jsp.el.FunctionMapper, javax.servlet.jsp.el.VariableResolver
Enclosing class:
ELEvaluator

public static class ELEvaluator.Context
extends Object
implements javax.servlet.jsp.el.VariableResolver, javax.servlet.jsp.el.FunctionMapper

Provides functions and variables for the EL evaluator.

All functions and variables in the context of an EL evaluator are accessible from EL expressions.


Constructor Summary
ELEvaluator.Context()
          Create an empty context.
 
Method Summary
 void addFunction(String prefix, String functionName, Method method)
          Add a function to the context.
 Object getVariable(String name)
          Return a variable from the context.
 Method resolveFunction(String prefix, String name)
          Resolve a function prefix:name.
 Object resolveVariable(String name)
          Resolve a variable name.
 void setVariable(String name, Object value)
          Add a variable to the context.
 void setVariables(Map<String,Object> vars)
          Add variables to the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ELEvaluator.Context

public ELEvaluator.Context()
Create an empty context.

Method Detail

setVariables

public void setVariables(Map<String,Object> vars)
Add variables to the context.

Parameters:
vars - variables to add to the context.

setVariable

public void setVariable(String name,
                        Object value)
Add a variable to the context.

Parameters:
name - variable name.
value - variable value.

getVariable

public Object getVariable(String name)
Return a variable from the context.

Parameters:
name - variable name.
Returns:
the variable value.

addFunction

public void addFunction(String prefix,
                        String functionName,
                        Method method)
Add a function to the context.

Parameters:
prefix - function prefix.
functionName - function name.
method - method that will be invoked for the function, it must be a static and public method.

resolveVariable

public Object resolveVariable(String name)
                       throws javax.servlet.jsp.el.ELException
Resolve a variable name. Used by the EL evaluator implemenation.

Specified by:
resolveVariable in interface javax.servlet.jsp.el.VariableResolver
Parameters:
name - variable name.
Returns:
the variable value.
Throws:
javax.servlet.jsp.el.ELException - thrown if the variable is not defined in the context.

resolveFunction

public Method resolveFunction(String prefix,
                              String name)
Resolve a function prefix:name. Used by the EL evaluator implementation.

Specified by:
resolveFunction in interface javax.servlet.jsp.el.FunctionMapper
Parameters:
prefix - function prefix.
name - function name.
Returns:
the method associated to the function.


Copyright © 2012 Apache Software Foundation. All Rights Reserved.