Package org.apache.tapestry5

Examples of org.apache.tapestry5.PropertyConduit


    }

    @Test
    public void list_as_method_argument()
    {
        PropertyConduit conduit = source.create(EchoBean.class, "echoList([ 1, 2.0, storedString ])");
        EchoBean bean = new EchoBean();

        bean.setStoredString("Bart");

        List l = (List) conduit.get(bean);

        assertListsEquals(l, new Long(1), new Double(2.0), "Bart");
    }
View Full Code Here


    }
   
    @Test
    public void arrays_as_method_argument()
    {
        PropertyConduit conduit = source.create(EchoBean.class, "echoArray(storedArray)");
        EchoBean bean = new EchoBean();

        bean.setStoredArray(new Number[][]{ new Integer[] {1, 2}, new Double[] {3.0, 4.0}});

        Number[][] array = (Number[][]) conduit.get(bean);

        assertArraysEqual(array[0], 1, 2);
        assertArraysEqual(array[1], 3.0, 4.0);
    }
View Full Code Here

   

    @Test
    public void not_operator()
    {
        PropertyConduit conduit = source.create(IntegerHolder.class, "! value");
        IntegerHolder holder = new IntegerHolder();

        assertEquals(conduit.get(holder), Boolean.TRUE);

        holder.setValue(99);

        assertEquals(conduit.get(holder), Boolean.FALSE);
    }
View Full Code Here

    }

    @Test
    public void not_operator_in_subexpression()
    {
        PropertyConduit conduit = source.create(Switch.class, "label(! value)");

        Switch sw = new Switch();

        assertEquals(conduit.get(sw), "aye");

        sw.setValue(true);

        assertEquals(conduit.get(sw), "nay");
    }
View Full Code Here

     * TAP5-330
     */
    @Test
    public void object_methods_can_be_invoked()
    {
        PropertyConduit conduit = source.create(Block.class, "toString()");

        Block b = new Block()
        {
            @Override
            public String toString()
            {
                return "Do You Grok Ze Block?";
            }
        };

        assertEquals(conduit.get(b), "Do You Grok Ze Block?");
    }
View Full Code Here

    @Test
    public void boolean_constant_as_method_parameter()
    {
        Bedrock bedrock = new Bedrock();

        PropertyConduit trueConduit = source.create(Bedrock.class, "toName(true)");
        PropertyConduit falseConduit = source.create(Bedrock.class, "toName(false)");

        assertEquals(trueConduit.get(bedrock), "Fred");
        assertEquals(falseConduit.get(bedrock), "Barney");
    }
View Full Code Here

    /** TAP5-747 */
    @Test
    public void dereference_result_of_method_invocation()
    {
        ComplexObject co = new ComplexObject();
        PropertyConduit pc = source.create(ComplexObject.class, "get(nestedIndex).name");

        assertEquals(pc.get(co), "zero");

        co.setNestedIndex(1);

        assertEquals(pc.get(co), "one");
    }
View Full Code Here

    {
        PublicFieldBean bean = new PublicFieldBean();

        bean.stringField = "x";

        PropertyConduit pc = source.create(PublicFieldBean.class, "stringField");

        assertEquals(pc.get(bean), "x");

        pc.set(bean, "y");

        assertEquals(bean.stringField, "y");
    }
View Full Code Here

        PublicFieldBean bean = new PublicFieldBean();
        PublicFieldBeanHolder holder = new PublicFieldBeanHolder(bean);

        bean.stringField = "x";

        PropertyConduit pc = source.create(PublicFieldBeanHolder.class, "bean.stringField");

        assertEquals(pc.get(holder), "x");

        pc.set(holder, "y");

        assertEquals(bean.stringField, "y");
    }
View Full Code Here

        bean.intField = 99;

        // check out the case insensitiveness:

        PropertyConduit pc = source.create(PublicFieldBean.class, "IntField");

        assertEquals(pc.get(bean), new Integer(99));

        pc.set(bean, 37);

        assertEquals(bean.intField, 37);
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.PropertyConduit

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.