Examples of PropertyAdapter


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

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

    }

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

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

        PublicFieldBean bean = new PublicFieldBean();

        pa.set(bean, "fred");

        assertEquals(bean.value, "fred");

        bean.value = "barney";

        assertEquals(pa.get(bean), "barney");
    }
View Full Code Here

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

    }

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

        assertFalse(pa.isField());

        ShadowedPublicFieldBean bean = new ShadowedPublicFieldBean();

        pa.set(bean, "fred");

        assertNull(bean.value);

        bean.value = "barney";
        bean.setValue("wilma");

        assertEquals(pa.get(bean), "wilma");
    }
View Full Code Here

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

    @Test
    public void access_property_from_unimplemented_interface_in_abstract_base_class()
    {
        AbstractBean bean = new ConcreteBean(33);

        PropertyAdapter valueAdapter = access.getAdapter(AbstractBean.class).getPropertyAdapter("value");

        assertNotNull(valueAdapter);
        assertFalse(valueAdapter.isField());

        valueAdapter.set(bean, "Hello");

        assertSame(valueAdapter.get(bean), "Hello");
        assertSame(bean.getValue(), "Hello");

        PropertyAdapter otherValueAdapter = access.getAdapter(AbstractBean.class).getPropertyAdapter("otherValue");

        assertNotNull(otherValueAdapter);
        assertFalse(otherValueAdapter.isField());

        otherValueAdapter.set(bean, "Other Value");

        assertSame(otherValueAdapter.get(bean), "Other Value");
        assertSame(bean.getOtherValue(), "Other Value");

        PropertyAdapter intValueAdapter = access.getAdapter(AbstractBean.class).getPropertyAdapter("intvalue");
        assertNotNull(intValueAdapter);

        assertEquals(intValueAdapter.get(bean), 33);

        assertTrue(intValueAdapter.isRead());
        assertFalse(intValueAdapter.isUpdate());
    }
View Full Code Here

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


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

        assertTrue(pa.isCastRequired());
        assertEquals(pa.getType(), String.class);
        assertSame(pa.getDeclaringClass(), GenericBean.class);
    }
View Full Code Here

Examples of org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.PropertyAdapter

  // Default
  //
  ////////////////////////////////////////////////////////////////////////////
  @Override
  public boolean isDefault(Object property) {
    PropertyAdapter propertyAdapter = (PropertyAdapter) property;
    Class<?> propertyType = propertyAdapter.getType();
    if (propertyType != null) {
      return ArrayUtils.contains(m_propertyClasses, propertyType.getName());
    }
    return false;
  }
View Full Code Here

Examples of org.python.pydev.refactoring.ast.adapters.PropertyAdapter

    private void printProperties(StringBuffer buffer, PropertyVisitor propertyVisitor) {
        Iterator<PropertyAdapter> iter = propertyVisitor.iterator();
        buffer.append("# " + propertyVisitor.getAll().size() + "\n");
        while (iter.hasNext()) {
            PropertyAdapter propertyAdapter = iter.next();
            buffer.append("# " + propertyAdapter.getParentName() + " " + propertyAdapter.getName() + " "
                    + propertyAdapter.isComplete() + " " + propertyAdapter.hasGetter() + " "
                    + propertyAdapter.hasSetter() + " " + propertyAdapter.hasDelete() + " "
                    + propertyAdapter.hasDocString() + "\n");
        }
        this.setTestGenerated(buffer.toString().trim());
    }
View Full Code Here

Examples of org.rhq.plugins.jbossas5.adapter.api.PropertyAdapter

                // Don't even add a Property to the Configuration if the ManagedProperty is flagged as removed or has a
                // null value.
                continue;
            }
            PropertySimple customProp = customProps.get(propName);
            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getCustomPropertyAdapter(customProp);
            if (propertyAdapter == null) {
                propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaValue);
            }
            if (propertyAdapter == null) {
                LOG.error("Unable to find a PropertyAdapter for ManagedProperty '" + propName + "' with MetaType ["
                    + metaValue.getMetaType() + "] for ResourceType '" + resourceType.getName() + "'.");
                continue;
            }
            Property property;
            try {
                property = propertyAdapter.convertToProperty(metaValue, propertyDefinition);
            } catch (RuntimeException e) {
                throw new RuntimeException("Failed to convert managed property " + managedProperty
                    + " to RHQ property of type " + propertyDefinition + ".", e);
            }
            config.put(property);
View Full Code Here

Examples of org.teiid.rhq.plugin.adapter.api.PropertyAdapter

        for (String propName : propMap.getMap().keySet())
        {
            Property mapMemberProp = propMap.get(propName);
            ManagedProperty managedProp = managedObject.getProperty(propName);
            MetaType metaType = managedProp.getMetaType();
            PropertyAdapter propertyAdapter = PropertyAdapterFactory.getPropertyAdapter(metaType);
            PropertyDefinition mapMemberPropDef = propDefMap.get(propName);
            if (managedProp.getValue() == null)
            {
                MetaValue managedPropMetaValue = propertyAdapter.convertToMetaValue(mapMemberProp, mapMemberPropDef, metaType);
                managedProp.setValue(managedPropMetaValue);
            }
            else
            {
                MetaValue managedPropMetaValue = (MetaValue)managedProp.getValue();
                propertyAdapter.populateMetaValueFromProperty(mapMemberProp, managedPropMetaValue, mapMemberPropDef);
            }
        }
    }
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.