Package org.apache.tapestry5.ioc.services

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


                return type.cast(current);
            }

            Throwable next = null;

            ClassPropertyAdapter adapter = access.getAdapter(current);

            for (String name : adapter.getPropertyNames())
            {

                Object value = adapter.getPropertyAdapter(name).get(current);

                if (value != null && value != current && value instanceof Throwable)
                {
                    next = (Throwable) value;
                    break;
View Full Code Here


    public <T> BeanModel<T> create(Class<T> beanClass, boolean filterReadOnlyProperties, Messages messages)
    {
        assert beanClass != null;
        assert messages != null;
        ClassPropertyAdapter adapter = propertyAccess.getAdapter(beanClass);

        BeanModel<T> model = new BeanModelImpl<T>(beanClass, propertyConduitSource, typeCoercer, messages, locator);

        for (final String propertyName : adapter.getPropertyNames())
        {
            PropertyAdapter pa = adapter.getPropertyAdapter(propertyName);

            if (!pa.isRead())
            {
                continue;
            }
View Full Code Here

    }

    @Test
    public void clear_wipes_internal_cache()
    {
        ClassPropertyAdapter cpa1 = access.getAdapter(Bean.class);

        assertSame(cpa1.getBeanType(), Bean.class);

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

        assertSame(cpa2, cpa1);

        access.clearCache();

        ClassPropertyAdapter cpa3 = access.getAdapter(Bean.class);

        assertNotSame(cpa3, cpa1);
    }
View Full Code Here

    }

    @Test
    public void class_property_adapter_toString()
    {
        ClassPropertyAdapter cpa = access.getAdapter(Bean.class);

        assertEquals(cpa.toString(), "<ClassPropertyAdaptor " + CLASS_NAME
                + "$Bean : PI, class, readOnly, value, writeOnly>");
    }
View Full Code Here

    }

    @Test
    public void property_adapter_read_only_property()
    {
        ClassPropertyAdapter cpa = access.getAdapter(Bean.class);
        PropertyAdapter pa = cpa.getPropertyAdapter("readOnly");

        assertTrue(pa.isRead());
        assertFalse(pa.isUpdate());
        assertFalse(pa.isCastRequired());
View Full Code Here

    }

    @Test
    public void property_adapter_write_only_property()
    {
        ClassPropertyAdapter cpa = access.getAdapter(Bean.class);
        PropertyAdapter pa = cpa.getPropertyAdapter("writeOnly");

        assertFalse(pa.isRead());
        assertTrue(pa.isUpdate());

        assertEquals(pa.getWriteMethod(), findMethod(Bean.class, "setWriteOnly"));
View Full Code Here

    }

    @Test
    public void class_property_adapter_returns_null_for_unknown_property()
    {
        ClassPropertyAdapter cpa = access.getAdapter(Bean.class);

        assertNull(cpa.getPropertyAdapter("google"));
    }
View Full Code Here

    }

    @Test
    public void access_to_property_type()
    {
        ClassPropertyAdapter cpa = access.getAdapter(Bean.class);

        assertEquals(cpa.getPropertyAdapter("value").getType(), int.class);
        assertEquals(cpa.getPropertyAdapter("readOnly").getType(), String.class);
        assertEquals(cpa.getPropertyAdapter("writeOnly").getType(), boolean.class);
    }
View Full Code Here

    }

    @Test
    public void property_names()
    {
        ClassPropertyAdapter cpa = access.getAdapter(Bean.class);

        assertEquals(cpa.getPropertyNames(), Arrays.asList("PI", "class", "readOnly", "value", "writeOnly"));
    }
View Full Code Here

    }

    @Test
    public void super_interface_methods_inherited_by_sub_interface()
    {
        ClassPropertyAdapter cpa = access.getAdapter(SubInterface.class);

        assertEquals(cpa.getPropertyNames(), Arrays.asList("grandParentProperty", "parentProperty", "subProperty"));
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.services.ClassPropertyAdapter

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.