Package org.apache.commons.jexl2

Examples of org.apache.commons.jexl2.JexlEngine$SoftCache


            // it worked!
        }
    }

    public void testVariable() throws Exception {
        JexlEngine jexl = new JexlEngine();
        jexl.setSilent(true);
        Asserter asserter = new Asserter(jexl);
        asserter.setVariable("foo", new Foo());
        asserter.setVariable("person", "James");

        asserter.assertExpression("person", "James");
View Full Code Here


  final JexlEngine engine;
  final Expression expr;
 
  public Extractor(String jexlExpression)
  {
    engine = new JexlEngine();
    engine.setSilent(true);
    expr = engine.createExpression(jexlExpression);
  }
View Full Code Here

            // it worked!
        }
    }

    public void testVariable() throws Exception {
        JexlEngine jexl = new JexlEngine();
        jexl.setSilent(true);
        Asserter asserter = new Asserter(jexl);
        asserter.setVariable("foo", new Foo());
        asserter.setVariable("person", "James");

        asserter.assertExpression("person", "James");
View Full Code Here

  private JexlEngine engine;
  private Expression expression;
  private boolean isStrict;

  public PartitionExpression(String expression, boolean isStrict) {
    this.engine = new JexlEngine();
    Map<String, Object> fns = new HashMap<String, Object>();
    fns.put(null, PartitionFunctions.class);
    this.engine.setFunctions(fns);
    this.engine.setStrict(true);
    this.engine.setSilent(false);
View Full Code Here

  private JexlEngine engine;
  private Expression expression;
  private boolean isStrict;

  public PartitionExpression(String expression, boolean isStrict) {
    this.engine = new JexlEngine();
    Map<String, Object> fns = new HashMap<String, Object>();
    fns.put(null, PartitionFunctions.class);
    this.engine.setFunctions(fns);
    this.engine.setStrict(true);
    this.engine.setSilent(false);
View Full Code Here

    /**
     * Get JexlEngine from ThreadLocal
     * @return JexlEngine
     */
    private static JexlEngine getJexlEngine() {
        JexlEngine engine = threadLocalJexl.get();
        if(engine == null) {
            engine = new JexlEngine();
            engine.setCache(512);
            engine.setLenient(false);
            engine.setSilent(false);
            threadLocalJexl.set(engine);
        }
        return engine;
    }
View Full Code Here

    public void threadStarted() {
    }

    @Override
    public void threadFinished() {
        JexlEngine engine = threadLocalJexl.get();
        if(engine != null) {
            engine.clearCache();
            threadLocalJexl.remove();
        }
    }
View Full Code Here

     * initialization code before expression creation &amp; evaluation.</p>
     * @param silent true means no JexlException will occur, false allows them
     */
    public void setJexlEngineSilent(boolean silent) {
        synchronized (this) {
            JexlEngine engine = getJexlEngine();
            engine.setSilent(silent);
            this.jexlEngineSilent = silent;
        }
    }
View Full Code Here

     * initialization code before expression creation &amp; evaluation.</p>
     * @param strict true for strict, false for lenient
     */
    public void setJexlEngineStrict(boolean strict) {
        synchronized (this) {
            JexlEngine engine = getJexlEngine();
            engine.setStrict(strict);
            this.jexlEngineStrict = strict;
        }
    }
View Full Code Here

     * This method can be overriden to specify more detailed options
     * into the JexlEngine.
     * @return
     */
    protected JexlEngine createJexlEngine() {
        JexlEngine engine = new JexlEngine();
        // With null prefix, define top-level user defined functions.
        // See javadoc of org.apache.commons.jexl2.JexlEngine#setFunctions(Map<String,Object> funcs) for detail.
        Map<String, Object> funcs = new HashMap<String, Object>();
        funcs.put(null, JexlBuiltin.class);
        engine.setFunctions(funcs);
        engine.setCache(256);
        return engine;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl2.JexlEngine$SoftCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.