Package org.apache.tapestry5

Examples of org.apache.tapestry5.PropertyConduit


        assertTrue(simple instanceof Serializable);

        simple.setFirstName("Howard");

        PropertyConduit conduit = source.create(proxyClass, "firstName");

        assertEquals(conduit.get(simple), "Howard");
    }
View Full Code Here


        StringHolder stringHolder = new StringHolder();
        stringHolder.put(string);
        StringHolderBean bean = new StringHolderBean();
        bean.setValue(stringHolder);

        PropertyConduit conduit = source.create(StringHolderBean.class, "value.get()");

        assertSame(conduit.get(bean), string);

        assertSame(conduit.getPropertyType(), String.class);
    }
View Full Code Here

        simple.setLastName(last);
        simple.setAge(2);
        simple.setFirstName(first);
        bean.holder.put(simple);

        PropertyConduit conduit = source.create(WithGenericProperties.class, "holder.get().firstName");
        assertSame(conduit.get(bean), first);
    }
View Full Code Here

        bean.type1Field = holder;
        bean.type2Field = 5678L;
        bean.type2ArrayField = new Long[]
                {123L, 456L};

        PropertyConduit conduit = source.create(RealizedParameters.class, "type1property.get().firstName");
        assertSame(conduit.get(bean), first);
        conduit.set(bean, "Change");
        assertSame(conduit.get(bean), "Change");
        conduit.set(bean, first);

        conduit = source.create(RealizedParameters.class, "type1field.get().firstName");
        assertSame(conduit.get(bean), first);

        conduit = source.create(RealizedParameters.class, "type2field");
        assertEquals(conduit.get(bean), bean.type2Field);

        conduit = source.create(RealizedParameters.class, "type2property");
        assertEquals(conduit.get(bean), bean.getType2Property());

        conduit = source.create(RealizedParameters.class, "type2ArrayField");
        assertEquals(conduit.get(bean), bean.type2ArrayField);

    }
View Full Code Here

    {
        final WithRealizedGenericInterface bean = new WithRealizedGenericInterface();
        bean.a = "Hello";
        bean.b = 12345L;

        PropertyConduit conduit = source.create(WithRealizedGenericInterface.class, "genericA()");
        assertSame(conduit.get(bean), "Hello");
        conduit = source.create(WithRealizedGenericInterface.class, "genericB()");
        assertEquals(conduit.get(bean), 12345L);
    }
View Full Code Here

        bean.setA("hello");
        bean.setB(123L);
        bean.setB2(1235L);
        bean.setX(54321L);

        PropertyConduit conduit = source.create(Three.class, "a");
        assertSame(conduit.get(bean), "hello");
    }
View Full Code Here

    }

    @Test
    public void null_root_object()
    {
        PropertyConduit conduit = source.create(StringHolderBean.class, "value.get()");

        try
        {
            conduit.get(null);
            unreachable();
        } catch (NullPointerException ex)
        {
            assertEquals(ex.getMessage(), "Root object of property expression 'value.get()' is null.");
        }
View Full Code Here

    }

    @Test
    public void null_property_in_chain()
    {
        PropertyConduit conduit = source.create(CompositeBean.class, "simple.lastName");

        CompositeBean bean = new CompositeBean();
        bean.setSimple(null);

        try
        {
            conduit.get(bean);
            unreachable();
        } catch (NullPointerException ex)
        {
            assertMessageContains(ex, "Property 'simple' (within property expression 'simple.lastName', of",
                    ") is null.");
View Full Code Here

    }

    @Test
    public void last_term_may_be_null()
    {
        PropertyConduit conduit = source.create(CompositeBean.class, "simple.firstName");

        CompositeBean bean = new CompositeBean();

        bean.getSimple().setFirstName(null);

        assertNull(conduit.get(bean));
    }
View Full Code Here

    }

    @Test
    public void field_annotations_are_visible()
    {
        PropertyConduit conduit = source.create(CompositeBean.class, "simple.firstName");

        Validate annotation = conduit.getAnnotation(Validate.class);

        assertNotNull(annotation);

        assertEquals(annotation.value(), "required");
    }
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.