Package org.apache.tapestry.ioc.services

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


        String id = "mycomponentid";

        ComponentResources resources = mockComponentResources();
        Component container = mockComponent();
        PropertyAccess access = newPropertyAccess();
        ClassPropertyAdapter classPropertyAdapter = newClassPropertyAdapter();
        BindingSource bindingSource = mockBindingSource();

        train_getId(resources, id);
        train_getContainer(resources, container);
View Full Code Here


        String id = "mycomponentid";

        ComponentResources resources = mockComponentResources();
        Component container = mockComponent();
        PropertyAccess access = newPropertyAccess();
        ClassPropertyAdapter classPropertyAdapter = newClassPropertyAdapter();
        PropertyAdapter propertyAdapter = newPropertyAdapter();
        BindingSource bindingSource = mockBindingSource();
        Binding binding = mockBinding();
        ComponentResources containerResources = mockComponentResources();
View Full Code Here

        Defense.notNull(beanClass, "beanClass");
        Defense.notNull(resources, "resources");

        Messages messages = resources.getMessages();

        ClassPropertyAdapter adapter = _propertyAccess.getAdapter(beanClass);

        BeanEditorModel model = new BeanEditorModelImpl(beanClass, adapter, _typeCoercer, messages);

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

            if (pa.isRead() && pa.isUpdate())
            {
                String editorType = _registry.get(pa.getType());
View Full Code Here

        return getAdapter(instance.getClass());
    }

    public ClassPropertyAdapter getAdapter(Class forClass)
    {
        ClassPropertyAdapter result = _adapters.get(forClass);

        if (result == null)
        {
            result = buildAdapter(forClass);
            _adapters.put(forClass, result);
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 : 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());

        assertNull(pa.getWriteMethod());
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

TOP

Related Classes of org.apache.tapestry.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.