net.sf.jett.expression
Class ClassAwareMapContext
java.lang.Object
org.apache.commons.jexl2.MapContext
net.sf.jett.expression.ClassAwareMapContext
- All Implemented Interfaces:
- org.apache.commons.jexl2.JexlContext
public class ClassAwareMapContext
- extends org.apache.commons.jexl2.MapContext
A ClassAwareMapContext is a JEXL MapContext that
can resolve class names using Class.forName for the purposes
of allowing access to built-in Java methods, especially static methods such
as java.lang.String.format.
- Since:
- 0.4.0
- Author:
- Randy Gettman
| Fields inherited from class org.apache.commons.jexl2.MapContext |
map |
|
Constructor Summary |
ClassAwareMapContext()
Constructs a ClassAwareMapContext that uses an automatically
allocated, empty Map. |
ClassAwareMapContext(java.util.Map<java.lang.String,java.lang.Object> beans)
Constructs a ClassAwareMapContext that wraps the existing
Map of bean names to bean values. |
|
Method Summary |
java.lang.Object |
get(java.lang.String name)
Retrieves the variable value, or the Class object, by name
as defined in this context. |
boolean |
has(java.lang.String name)
Checks whether the name is a variable defined in this context, or if it
is a valid Java class name as determined by Class.forName. |
| Methods inherited from class org.apache.commons.jexl2.MapContext |
set |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassAwareMapContext
public ClassAwareMapContext()
- Constructs a
ClassAwareMapContext that uses an automatically
allocated, empty Map.
ClassAwareMapContext
public ClassAwareMapContext(java.util.Map<java.lang.String,java.lang.Object> beans)
- Constructs a
ClassAwareMapContext that wraps the existing
Map of bean names to bean values.
- Parameters:
beans - A Map of bean names to bean values.
has
public boolean has(java.lang.String name)
- Checks whether the name is a variable defined in this context, or if it
is a valid Java class name as determined by
Class.forName.
- Specified by:
has in interface org.apache.commons.jexl2.JexlContext- Overrides:
has in class org.apache.commons.jexl2.MapContext
- Parameters:
name - The variable's or class's name.
- Returns:
true if the name exists, otherwise
false.
get
public java.lang.Object get(java.lang.String name)
- Retrieves the variable value, or the
Class object, by name
as defined in this context.
- Specified by:
get in interface org.apache.commons.jexl2.JexlContext- Overrides:
get in class org.apache.commons.jexl2.MapContext
- Parameters:
name - The variable's name or class's name.
- Returns:
- The variable value or
Class object.
Copyright © 2012-2013 Jett Team. All Rights Reserved.