Examples of defineBean()


Examples of javax.el.ELProcessor.defineBean()

    public void testGetType01() {
        ELProcessor processor = new ELProcessor();
        ELContext context = processor.getELManager().getELContext();
        ExpressionFactory factory = ELManager.getExpressionFactory();

        processor.defineBean("bean01", new TesterBeanB());
        ValueExpression ve = factory.createValueExpression(
                context, "${bean01.text = 'hello'}", String.class);

        Assert.assertEquals(String.class, ve.getType(context));
        Assert.assertEquals("hello", ve.getValue(context));
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()

    public void testGetType02() {
        ELProcessor processor = new ELProcessor();
        ELContext context = processor.getELManager().getELContext();
        ExpressionFactory factory = ELManager.getExpressionFactory();

        processor.defineBean("bean01", new TesterBeanB());
        ValueExpression ve = factory.createValueExpression(
                context, "${bean01.text = 'hello'; bean01.text}", String.class);

        Assert.assertEquals(String.class, ve.getType(context));
        Assert.assertEquals("hello", ve.getValue(context));
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()

    @Test
    public void testToList02() {
        ELProcessor processor = new ELProcessor();
        String[] src = new String[] { "a", "b", "c" };
        processor.defineBean("src", src);
        Object result = processor.getValue("src.stream().toList()",
                List.class);
        List<String> expected = new ArrayList<>(3);
        expected.add("a");
        expected.add("b");
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()


    @Test
    public void testFilter01() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);
        Object result = processor.getValue(
                "beans.stream().filter(b->b.valLong > 2).toList()",
                List.class);
        List<TesterBeanA> expected = new ArrayList<>(1);
        expected.add(bean03);
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()


    @Test
    public void testMap01() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);
        Object result = processor.getValue(
                "beans.stream().map(b->b.name).toList()",
                List.class);
        List<String> expected = new ArrayList<>(3);
        expected.add("bean01");
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()


    @Test
    public void testMap02() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);
        Object result = processor.getValue(
                "beans.stream().filter(b->b.valLong > 1).map(b->[b.name, b.valLong]).toList()",
                List.class);

        Assert.assertTrue(result instanceof List);
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()


    @Test
    public void testFlatMap01() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);
        Object result = processor.getValue(
                "beans.stream().flatMap(b->b.name.toCharArray().stream()).toList()",
                List.class);

        List<Character> expected = new ArrayList<>(18);
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()


    @Test
    public void testForEach01() {
        ELProcessor processor = new ELProcessor();
        processor.defineBean("beans", beans);
        processor.getValue(
                "beans.stream().forEach(b->b.setValLong(b.valLong + 1))",
                Object.class);

        Assert.assertEquals(2, bean01.getValLong());
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()

    @Test
    public void testPeek01() {
        ELProcessor processor = new ELProcessor();
        List<TesterBeanA> debug = new ArrayList<>();
        processor.defineBean("beans", beans);
        processor.defineBean("debug", debug);

        Object result = processor.getValue(
                "beans.stream().peek(b->debug.add(b)).toList()",
                Object.class);
View Full Code Here

Examples of javax.el.ELProcessor.defineBean()

    @Test
    public void testPeek01() {
        ELProcessor processor = new ELProcessor();
        List<TesterBeanA> debug = new ArrayList<>();
        processor.defineBean("beans", beans);
        processor.defineBean("debug", debug);

        Object result = processor.getValue(
                "beans.stream().peek(b->debug.add(b)).toList()",
                Object.class);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.