Package de.odysseus.el.util

Examples of de.odysseus.el.util.SimpleContext


    SimpleContext context = new SimpleContext(new SimpleResolver());
    assertEquals("1", factory.createValueExpression("1", Object.class).getValue(context));
  }

  public void testCreateMethodExpression() throws NoSuchMethodException {
    SimpleContext context = new SimpleContext(new SimpleResolver());
    context.getELResolver().setValue(context, null, "foo", this);
    assertEquals(bar(), factory.createMethodExpression(context, "${foo.bar}", null, new Class[0]).invoke(context, null));
  }
View Full Code Here


  /**
   * Usage example.
   */
  public static void main(String[] args) throws SAXException, IOException {
    // create our expression context
    ELContext context = new SimpleContext();
    // set value for top-level property "home"
    context.getELResolver().setValue(context, null, "home", "/foo/bar");
    // create our filtered reader
    XMLReader reader = new XMELFilter(XMLReaderFactory.createXMLReader(), context);
    // simple test content handler to print elements and attributes to stdout
    reader.setContentHandler(new DefaultHandler() {
      @Override
View Full Code Here

  /**
   * Usage example.
   */
  public static void main(String[] args) throws SAXException, IOException {
    // create our expression context
    ELContext context = new SimpleContext();
    // set value for top-level property "home"
    context.getELResolver().setValue(context, null, "home", "/foo/bar");
    // create our filtered reader
    XMLReader reader = new AttributesFilter(XMLReaderFactory.createXMLReader(), context);
    // simple test content handler to print elements and attributes to stdout
    reader.setContentHandler(new DefaultHandler() {
      @Override
View Full Code Here

  /**
   * Usage example.
   */
  public static void main(String[] args) throws SAXException, IOException {
    // create our expression context
    ELContext context = new SimpleContext();
    // set value for top-level property "home"
    context.getELResolver().setValue(context, null, "home", "/foo/bar");
    // create our filtered reader
    XMLReader reader = new TextFilter(XMLReaderFactory.createXMLReader(), context);
    // simple test content handler to print elements and attributes to stdout
    reader.setContentHandler(new DefaultHandler() {
      @Override
View Full Code Here

        "${'abab' matches '(ba)*'}",
        "${'abab' ~ '(ab)*'}",
        "${'abab' ~ '(ba)*'}"
    };

    SimpleContext context = new SimpleContext();
    for (String expression : expressions) {
      ValueExpression e = factory.createValueExpression(context, expression, boolean.class);
      System.out.println(expression + " --> " + e.getValue(context));
    }
  }
View Full Code Here

  SimpleContext context;
  TreeStore store = new TreeStore(new Builder(), null);
 
  @Override
  protected void setUp() throws Exception {
    context = new SimpleContext(new SimpleResolver(new BeanELResolver()));
    context.getELResolver().setValue(context, null, "base", this);

    // variables var_long_1, var_long_2
    context.setVariable("var_long_1", new TreeValueExpression(store, null, null, null, "${1}", long.class));
    context.setVariable("var_long_2", new TreeValueExpression(store, null, null, null, "${1}", long.class));
View Full Code Here

//    ExpressionFactory f = new ExpressionFactoryImpl(System.getProperties());
    ExpressionFactory f = new ExpressionFactoryImpl(); // varargs are enabled by default

    // create our context with function "vararg:format"
    Method method = String.class.getMethod("format", new Class[]{String.class, Object[].class});
    SimpleContext context = new SimpleContext();
    context.setFunction("varargs", "format", method);

    // our expression we want to evaluate
    String expression = "${varargs:format('Hey %s','Joe')}";

    // let's go...
View Full Code Here

  private SimpleContext context;
 
  @Override
  protected void setUp() throws Exception {
    context = new SimpleContext();
   
    // function ns:f()
    context.setFunction("ns", "f", BindingsTest.class.getMethod("foo"));

    // function g()
View Full Code Here

  private SimpleContext context;
 
  @Override
  protected void setUp() throws Exception {
    context = new SimpleContext();
   
    // functions ns:f0(), ns:f1(int)
    context.setFunction("ns", "f0", TreeTest.class.getMethod("foo"));
    context.setFunction("ns", "f1", TreeTest.class.getMethod("bar", new Class[]{int.class}));
View Full Code Here

  SimpleContext context;
  TreeStore store = new TreeStore(new Builder(Feature.METHOD_INVOCATIONS), null);
 
  @Override
  protected void setUp() throws Exception {
    context = new SimpleContext(new SimpleResolver(new BeanELResolver()));
    context.getELResolver().setValue(context, null, "base", this);
  }
View Full Code Here

TOP

Related Classes of de.odysseus.el.util.SimpleContext

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.