Examples of PropertyAdapter


Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    }

    @Test
    public void get_annotation_when_annotation_not_present()
    {
        PropertyAdapter pa = access.getAdapter(AnnotatedBean.class).getPropertyAdapter("readWrite");

        assertNull(pa.getAnnotation(Scope.class));
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    }

    @Test
    public void get_annotation_with_annotation_on_write_method()
    {
        PropertyAdapter pa = access.getAdapter(AnnotatedBean.class).getPropertyAdapter("annotationOnWrite");

        Scope annotation = pa.getAnnotation(Scope.class);
        assertNotNull(annotation);

        assertEquals(annotation.value(), "onwrite");
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    }

    @Test
    public void read_method_annotation_overrides_write_method_annotation()
    {
        PropertyAdapter pa = access.getAdapter(AnnotatedBean.class).getPropertyAdapter("annotationOnRead");

        Scope annotation = pa.getAnnotation(Scope.class);
        assertNotNull(annotation);

        assertEquals(annotation.value(), "onread");
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    }

    @Test
    public void no_write_method_reading_missing_annotation()
    {
        PropertyAdapter pa = access.getAdapter(AnnotatedBean.class).getPropertyAdapter("readOnly");

        assertNull(pa.getAnnotation(Scope.class));
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    }

    @Test
    public void get_annotation_will_read_field()
    {
        PropertyAdapter pa = access.getAdapter(Bean.class).getPropertyAdapter("value");

        DataType dt = pa.getAnnotation(DataType.class);

        assertNotNull(dt);
        assertEquals(dt.value(), "fred");
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

     * TAPESTRY-2448
     */
    @Test
    public void get_annotation_will_read_inherited_field()
    {
        PropertyAdapter pa = access.getAdapter(BeanSubclass.class).getPropertyAdapter("value");

        DataType dt = pa.getAnnotation(DataType.class);

        assertNotNull(dt);
        assertEquals(dt.value(), "fred");

    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    }

    @Test
    public void field_annotation_overridden_by_getter_annotation()
    {
        PropertyAdapter pa = access.getAdapter(Bean.class).getPropertyAdapter("value");

        assertEquals(pa.getAnnotation(Validate.class).value(), "getter-value-overrides");
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    @Test
    public void using_generics()
    {
        ClassPropertyAdapter cpa1 = access.getAdapter(StringLongPair.class);

        PropertyAdapter pa1 = cpa1.getPropertyAdapter("key");
        assertSame(pa1.getType(), String.class);
        assertTrue(pa1.isCastRequired());

        assertSame(pa1.getDeclaringClass(), Pair.class);

        PropertyAdapter pa2 = cpa1.getPropertyAdapter("value");
        assertSame(pa2.getType(), Long.class);
        assertTrue(pa2.isCastRequired());

        // On the base class, which defines the generic parameter type variables,
        // the properties just look like Object.

        ClassPropertyAdapter cpa2 = access.getAdapter(Pair.class);

        pa1 = cpa2.getPropertyAdapter("key");
        assertSame(pa1.getType(), Object.class);
        assertFalse(pa1.isCastRequired());

        pa2 = cpa2.getPropertyAdapter("value");
        assertSame(pa2.getType(), Object.class);
        assertFalse(pa2.isCastRequired());

    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    }

    @Test
    public void get_scala_properties_with_bean_accessors()
    {
        PropertyAdapter pa = access.getAdapter(ScalaBean.class).getPropertyAdapter("value");

        // even thought scala accessors are present the java bean ones should be the ones used by Tapestry
        assertEquals(pa.getReadMethod().getName(), "getValue");
        assertEquals(pa.getWriteMethod().getName(), "setValue");
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.PropertyAdapter

    }

    @Test
    public void get_scala_properties()
    {
        PropertyAdapter pa = access.getAdapter(ScalaClass.class).getPropertyAdapter("value");

        assertEquals(pa.getReadMethod().getName(), "value");
        assertEquals(pa.getWriteMethod().getName(), "value_$eq");
    }
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.