1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jexl;
18
19 import org.apache.commons.jexl.context.HashMapContext;
20
21 /***
22 * Helper to create a context. In the current implementation of JEXL, there
23 * is one implementation of JexlContext - {@link HashMapContext}, and there
24 * is no reason not to directly instantiate {@link HashMapContext} in your
25 * own application.
26 *
27 * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
28 * @version $Id: JexlHelper.java,v 1.4 2004/06/12 23:53:17 tobrien Exp $
29 */
30 public class JexlHelper
31 {
32 protected static JexlHelper helper = new JexlHelper();
33
34 protected static JexlHelper getInstance()
35 {
36 return helper;
37 }
38
39 /***
40 * Returns a new {@link JexlContext}.
41 * @return a new JexlContext
42 */
43 public static JexlContext createContext()
44 {
45 return getInstance().newContext();
46 }
47
48 /***
49 * Creates and returns a new {@link JexlContext}. The current implementation
50 * creates a new instance of {@link HashMapContext}.
51 * @return a new JexlContext
52 */
53 protected JexlContext newContext()
54 {
55 return new HashMapContext();
56 }
57 }