Package de.odysseus.el.util

Examples of de.odysseus.el.util.SimpleContext


import de.odysseus.el.util.SimpleContext;

public class ELContextTest extends TestCase {

  public void testContext() {
    ELContext context = new SimpleContext();
    assertNull(context.getContext(Integer.class));
    context.putContext(Integer.class, "foo");
    assertEquals("foo", context.getContext(Integer.class));
  }
View Full Code Here


    context.putContext(Integer.class, "foo");
    assertEquals("foo", context.getContext(Integer.class));
  }

  public void testLocale() {
    ELContext context = new SimpleContext();
    assertNull(context.getLocale());
    context.setLocale(Locale.ENGLISH);
    assertEquals(Locale.ENGLISH, context.getLocale());
  }
View Full Code Here

    context.setLocale(Locale.ENGLISH);
    assertEquals(Locale.ENGLISH, context.getLocale());
  }

  public void testPropertyResolved() {
    ELContext context = new SimpleContext();
    assertFalse(context.isPropertyResolved());
    context.setPropertyResolved(true);
    assertTrue(context.isPropertyResolved());
  }
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

    return value;
  }

  @Override
  protected void setUp() throws Exception {
    context = new SimpleContext(new SimpleResolver());
    context.getELResolver().setValue(context, null, "base", this);
   
    HashMap<Object,String> nullmap = new HashMap<Object,String>();
    nullmap.put(null, "foo");
    context.getELResolver().setValue(context, null, "nullmap", nullmap);
View Full Code Here

    return value;
  }

  @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

    return value;
  }

  @Override
  protected void setUp() throws Exception {
    context = new SimpleContext(new SimpleResolver());
    context.getELResolver().setValue(context, null, "base", this);
   
    HashMap<Object,String> nullmap = new HashMap<Object,String>();
    nullmap.put(null, "foo");
    context.getELResolver().setValue(context, null, "nullmap", nullmap);
View Full Code Here

    return value;
  }

  @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

    CompositeELResolver resolver = new CompositeELResolver();
    resolver.add(new PublicMethodResolver());
    resolver.add(new BeanELResolver());

    // create our context
    ELContext context = new SimpleContext(resolver);

    // let's go...
    ValueExpression e = null;
   
    e = f.createValueExpression(context, "${'foo'.matches('foo|bar')}", boolean.class);
View Full Code Here

    // create our factory which uses our customized builder
    System.setProperty("javax.el.nullProperties", "true");   
    ExpressionFactory f = new ExpressionFactoryImpl(System.getProperties());

    // create our context
    ELContext context = new SimpleContext();

    // create our expression we want to evaluate
    ValueExpression e = f.createValueExpression(context, "${map[null]}", String.class);

    // create a map containing a value for key <code>null</code> and make it available
    Map<String, String> map = new HashMap<String, String>();
    map.put(null, "foo");
    context.getELResolver().setValue(context, null, "map", map);

    // let's go...
    System.out.println(e.getValue(context)); // --> "foo"
  }
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.