Package de.odysseus.el.tree

Examples of de.odysseus.el.tree.Bindings


    }
    NodePrinter.dump(out, tree.getRoot());
    if (!tree.getFunctionNodes().iterator().hasNext() && !tree.getIdentifierNodes().iterator().hasNext()) {
      out.print(">> ");
      try {
        out.println(tree.getRoot().getValue(new Bindings(null, null), new SimpleContext(), null));
      } catch (ELException e) {
        out.println(e.getMessage());
      }
    }
    out.flush();
View Full Code Here


    // variable v
    context.setVariable("v", new ObjectValueExpression(TypeConverter.DEFAULT, new Long(0), long.class));
  }

  public void testSerialize() throws Exception {
    Bindings bindings = null;

    bindings = new Bindings(null, null);
    assertEquals(bindings, deserialize(serialize(bindings)));

    bindings = parse("${ns:f()+v+g(1)+x}").bind(context.getFunctionMapper(), context.getVariableMapper());
    assertEquals(bindings, deserialize(serialize(bindings)));
  }
View Full Code Here

    bindings = parse("${ns:f()+v+g(1)+x}").bind(context.getFunctionMapper(), context.getVariableMapper());
    assertEquals(bindings, deserialize(serialize(bindings)));
  }
 
  public void testEqualsAndHashcode() throws Exception {
    Bindings bindings1 = null;
    Bindings bindings2 = null;

    bindings1 = new Bindings(null, null);
    bindings2 = new Bindings(null, null);
    assertEquals(bindings1, bindings2);
    assertEquals(bindings1.hashCode(), bindings2.hashCode());

    bindings1 = new Bindings(new Method[0], new ValueExpression[0]);
    bindings2 = new Bindings(null, null);
    assertEquals(bindings1, bindings2);
    assertEquals(bindings1.hashCode(), bindings2.hashCode());

    Tree tree = parse("${ns:f()+v+g(1)}+x");
    bindings1 = tree.bind(context.getFunctionMapper(), context.getVariableMapper());
    bindings2 = tree.bind(context.getFunctionMapper(), context.getVariableMapper());
    assertEquals(bindings1, bindings2);
    assertEquals(bindings1.hashCode(), bindings2.hashCode());
  }
View Full Code Here

   
    HashMap<Object,String> nullmap = new HashMap<Object,String>();
    nullmap.put(null, "foo");
    context.getELResolver().setValue(context, null, "nullmap", nullmap);
   
    bindings = new Bindings(null, new ValueExpression[2]);
  }
View Full Code Here

    assertEquals(1l, parseNode("${base['foo']}").eval(bindings, context));
  }

  public void testAppendStructure() {
    StringBuilder s = new StringBuilder();
    parseNode("${foo[bar]}").appendStructure(s, new Bindings(null, null));
    assertEquals("foo[bar]", s.toString());
  }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    context = new SimpleContext(new SimpleResolver(new BeanELResolver()));
    context.getELResolver().setValue(context, null, "base", this);
   
    bindings = new Bindings(null, new ValueExpression[1]);
  }
View Full Code Here

    assertEquals(1l, parseNode("${base.foo}").eval(bindings, context));
  }

  public void testAppendStructure() {
    StringBuilder s = new StringBuilder();
    parseNode("${foo.bar}").appendStructure(s, new Bindings(null, null, null));
    assertEquals("foo.bar", s.toString());
  }
View Full Code Here

   
    HashMap<Object,String> nullmap = new HashMap<Object,String>();
    nullmap.put(null, "foo");
    context.getELResolver().setValue(context, null, "nullmap", nullmap);
   
    bindings = new Bindings(null, new ValueExpression[2]);
  }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    context = new SimpleContext(new SimpleResolver(new BeanELResolver()));
    context.getELResolver().setValue(context, null, "base", this);
   
    bindings = new Bindings(null, new ValueExpression[1]);
  }
View Full Code Here

    context.setVariable("var_property_long_1", new TreeValueExpression(new TreeStore(BUILDER, null), null, context.getVariableMapper(), "${property_long_1}", long.class))
  }

  public void testEval() {
    Tree tree = null;
    Bindings bindings = null;

    tree = parse("${bad}");
    bindings = tree.bind(null, context.getVariableMapper());
    try { getNode(tree).eval(bindings, context); fail(); } catch (ELException e) {}
   
View Full Code Here

TOP

Related Classes of de.odysseus.el.tree.Bindings

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.