Search in sources :

Example 81 with IndexedPropertyDescriptor

use of java.beans.IndexedPropertyDescriptor in project j2objc by google.

the class IntrospectorTest method test_MixedSimpleClass8.

public void test_MixedSimpleClass8() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedSimpleClass8.class);
    Method setter = MixedSimpleClass8.class.getDeclaredMethod("setList", Object.class);
    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertFalse(pd instanceof IndexedPropertyDescriptor);
            assertNull(pd.getReadMethod());
            assertEquals(setter, pd.getWriteMethod());
        }
    }
}
Also used : IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) PropertyDescriptor(java.beans.PropertyDescriptor) BeanInfo(java.beans.BeanInfo) SimpleBeanInfo(java.beans.SimpleBeanInfo) FakeFox01BeanInfo(org.apache.harmony.beans.tests.support.mock.FakeFox01BeanInfo) IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) Method(java.lang.reflect.Method)

Example 82 with IndexedPropertyDescriptor

use of java.beans.IndexedPropertyDescriptor in project j2objc by google.

the class IntrospectorTest method test_MixedSimpleClass14.

public void test_MixedSimpleClass14() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedSimpleClass14.class);
    Method getter = MixedSimpleClass14.class.getDeclaredMethod("getList", int.class);
    Method setter = MixedSimpleClass14.class.getDeclaredMethod("setList", int.class, Object.class);
    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertEquals(getter, ((IndexedPropertyDescriptor) pd).getIndexedReadMethod());
            assertEquals(setter, ((IndexedPropertyDescriptor) pd).getIndexedWriteMethod());
        }
    }
}
Also used : IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) PropertyDescriptor(java.beans.PropertyDescriptor) BeanInfo(java.beans.BeanInfo) SimpleBeanInfo(java.beans.SimpleBeanInfo) FakeFox01BeanInfo(org.apache.harmony.beans.tests.support.mock.FakeFox01BeanInfo) IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) Method(java.lang.reflect.Method)

Example 83 with IndexedPropertyDescriptor

use of java.beans.IndexedPropertyDescriptor in project j2objc by google.

the class IntrospectorTest method test_MixedBooleanSimpleClass16.

public void test_MixedBooleanSimpleClass16() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedBooleanSimpleClass16.class);
    Method getter = MixedBooleanSimpleClass16.class.getDeclaredMethod("getList", int.class);
    Method setter = MixedBooleanSimpleClass16.class.getDeclaredMethod("setList", int.class, boolean.class);
    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertEquals(getter, ((IndexedPropertyDescriptor) pd).getIndexedReadMethod());
            assertEquals(setter, ((IndexedPropertyDescriptor) pd).getIndexedWriteMethod());
        }
    }
}
Also used : IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) PropertyDescriptor(java.beans.PropertyDescriptor) BeanInfo(java.beans.BeanInfo) SimpleBeanInfo(java.beans.SimpleBeanInfo) FakeFox01BeanInfo(org.apache.harmony.beans.tests.support.mock.FakeFox01BeanInfo) IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) Method(java.lang.reflect.Method)

Example 84 with IndexedPropertyDescriptor

use of java.beans.IndexedPropertyDescriptor in project j2objc by google.

the class IntrospectorTest method test_MixedBooleanSimpleClass40.

public void test_MixedBooleanSimpleClass40() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedBooleanSimpleClass40.class);
    Method setter = MixedBooleanSimpleClass40.class.getDeclaredMethod("setList", int.class, boolean.class);
    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertNull(((IndexedPropertyDescriptor) pd).getIndexedReadMethod());
            assertEquals(setter, ((IndexedPropertyDescriptor) pd).getIndexedWriteMethod());
            break;
        }
    }
}
Also used : IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) PropertyDescriptor(java.beans.PropertyDescriptor) BeanInfo(java.beans.BeanInfo) SimpleBeanInfo(java.beans.SimpleBeanInfo) FakeFox01BeanInfo(org.apache.harmony.beans.tests.support.mock.FakeFox01BeanInfo) IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) Method(java.lang.reflect.Method)

Example 85 with IndexedPropertyDescriptor

use of java.beans.IndexedPropertyDescriptor in project spring-framework by spring-projects.

the class ExtendedBeanInfo method findExistingPropertyDescriptor.

private PropertyDescriptor findExistingPropertyDescriptor(String propertyName, Class<?> propertyType) {
    for (PropertyDescriptor pd : this.propertyDescriptors) {
        final Class<?> candidateType;
        final String candidateName = pd.getName();
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            candidateType = ipd.getIndexedPropertyType();
            if (candidateName.equals(propertyName) && (candidateType.equals(propertyType) || candidateType.equals(propertyType.getComponentType()))) {
                return pd;
            }
        } else {
            candidateType = pd.getPropertyType();
            if (candidateName.equals(propertyName) && (candidateType.equals(propertyType) || propertyType.equals(candidateType.getComponentType()))) {
                return pd;
            }
        }
    }
    return null;
}
Also used : IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor) PropertyDescriptor(java.beans.PropertyDescriptor) IndexedPropertyDescriptor(java.beans.IndexedPropertyDescriptor)

Aggregations

IndexedPropertyDescriptor (java.beans.IndexedPropertyDescriptor)197 Method (java.lang.reflect.Method)167 PropertyDescriptor (java.beans.PropertyDescriptor)142 BeanInfo (java.beans.BeanInfo)126 SimpleBeanInfo (java.beans.SimpleBeanInfo)126 FakeFox01BeanInfo (org.apache.harmony.beans.tests.support.mock.FakeFox01BeanInfo)126 MockJavaBean (org.apache.harmony.beans.tests.support.mock.MockJavaBean)49 IntrospectionException (java.beans.IntrospectionException)17 EventSetDescriptor (java.beans.EventSetDescriptor)3 MethodDescriptor (java.beans.MethodDescriptor)2 PropertyInfo (cern.gp.beans.PropertyInfo)1 CachingStrategy (cern.gp.nodes.cache.CachingStrategy)1 NoCachingStrategy (cern.gp.nodes.cache.NoCachingStrategy)1 StickyCachingStrategy (cern.gp.nodes.cache.StickyCachingStrategy)1 TimeLimitedCachingStrategy (cern.gp.nodes.cache.TimeLimitedCachingStrategy)1 KeyEvent (java.awt.event.KeyEvent)1 KeyListener (java.awt.event.KeyListener)1 BeanDescriptor (java.beans.BeanDescriptor)1 FeatureDescriptor (java.beans.FeatureDescriptor)1 IndexedPropertyChangeEvent (java.beans.IndexedPropertyChangeEvent)1