类java.beans.IndexedPropertyDescriptor源码实例Demo

下面列出了怎么用java.beans.IndexedPropertyDescriptor的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: spring-analysis-note   文件: ExtendedBeanInfo.java
@Nullable
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;
}
 
源代码2 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedSimpleClass56() throws Exception {
    BeanInfo beanInfo = Introspector.getBeanInfo(MixedSimpleClass56.class);
    Method getter = MixedSimpleClass56.class.getMethod("getList",
            new Class<?>[] { int.class });
    Method setter = MixedSimpleClass56.class.getMethod("setList",
            new Class<?>[] { int.class, boolean.class });
    assertEquals(2, beanInfo.getPropertyDescriptors().length);
    for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertEquals(getter,
                    ((IndexedPropertyDescriptor) pd).getIndexedReadMethod());
            assertEquals(setter,
                    ((IndexedPropertyDescriptor) pd)
                            .getIndexedWriteMethod());
        }
    }
}
 
源代码3 项目: j2objc   文件: IndexedPropertyDescriptorTest.java
public void testEquals_ReadMethod() throws SecurityException,
        NoSuchMethodException, IntrospectionException {
    String propertyName = "PropertyFour";
    Class<MockJavaBean> beanClass = MockJavaBean.class;

    Method readMethod = beanClass.getMethod("getPropertyFive",
            (Class[]) null);
    Method writeMethod = beanClass.getMethod("set" + propertyName,
            new Class[] { String[].class });
    Method indexedReadMethod = beanClass.getMethod("get" + propertyName,
            new Class[] { Integer.TYPE });
    Method indexedWriteMethod = beanClass.getMethod("set" + propertyName,
            new Class[] { Integer.TYPE, String.class });

    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(
            propertyName, readMethod, writeMethod, indexedReadMethod,
            indexedWriteMethod);

    IndexedPropertyDescriptor ipd2 = new IndexedPropertyDescriptor(
            propertyName, beanClass);

    assertFalse(ipd.equals(ipd2));
}
 
源代码4 项目: lams   文件: ExtendedBeanInfo.java
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;
}
 
源代码5 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedBooleanExtendClass13() throws Exception {
    BeanInfo info = Introspector
            .getBeanInfo(MixedBooleanExtendClass13.class);
    Method getter = MixedBooleanSimpleClass42.class
            .getDeclaredMethod("isList");
    Method setter = MixedBooleanSimpleClass42.class.getDeclaredMethod(
            "setList", boolean.class);

    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertFalse(pd instanceof IndexedPropertyDescriptor);
            assertEquals(getter, pd.getReadMethod());
            assertEquals(setter, pd.getWriteMethod());
        }
    }
}
 
源代码6 项目: j2objc   文件: IndexedPropertyDescriptorTest.java
public void testHashCode() throws Exception {
    String propertyName = "PropertyFour";
    Class<MockJavaBean> beanClass = MockJavaBean.class;

    Method readMethod = beanClass.getMethod("get" + propertyName,
            (Class[]) null);
    Method writeMethod = beanClass.getMethod("set" + propertyName,
            new Class[] { String[].class });
    Method indexedReadMethod = beanClass.getMethod("get" + propertyName,
            new Class[] { Integer.TYPE });
    Method indexedWriteMethod = beanClass.getMethod("set" + propertyName,
            new Class[] { Integer.TYPE, String.class });

    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(
            propertyName, readMethod, writeMethod, indexedReadMethod,
            indexedWriteMethod);

    IndexedPropertyDescriptor ipd2 = new IndexedPropertyDescriptor(
            propertyName, beanClass);

    assertEquals(ipd, ipd2);
    assertEquals(ipd.hashCode(), ipd2.hashCode());
}
 
源代码7 项目: jdk8u_jdk   文件: Test8034085.java
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
 
源代码8 项目: dragonwell8_jdk   文件: Test6976577.java
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
 
源代码9 项目: j2objc   文件: IndexedPropertyDescriptorTest.java
public void testIndexedPropertyDescriptorStringClassStringStringStringString_WriteMethodNull()
        throws IntrospectionException {
    String propertyName = "PropertyFour";
    Class<MockJavaBean> beanClass = MockJavaBean.class;
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(
            propertyName, beanClass, "get" + propertyName, null, "get"
                    + propertyName, "set" + propertyName);
    assertNotNull(ipd.getReadMethod());
    assertNull(ipd.getWriteMethod());
    assertEquals(String.class, ipd.getIndexedPropertyType());

    new IndexedPropertyDescriptor(
            propertyName, beanClass, "get" + propertyName, "set"+propertyName, "", "set" + propertyName);

    try{
        new IndexedPropertyDescriptor(
            propertyName, beanClass, "get" + propertyName, "set"+propertyName, "get" + propertyName, "");
    fail();
    }catch(Exception e){
    }
}
 
源代码10 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedBooleanSimpleClass6() throws Exception {
    BeanInfo info = Introspector
            .getBeanInfo(MixedBooleanSimpleClass6.class);
    Method getter = MixedBooleanSimpleClass6.class
            .getDeclaredMethod("getList");
    Method setter = MixedBooleanSimpleClass6.class.getDeclaredMethod(
            "setList", boolean.class);

    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertFalse(pd instanceof IndexedPropertyDescriptor);
            assertEquals(getter, pd.getReadMethod());
            assertEquals(setter, pd.getWriteMethod());
        }
    }
}
 
源代码11 项目: hottub   文件: Test8034085.java
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
 
源代码12 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedSimpleClass23() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedSimpleClass23.class);
    Method setter = MixedSimpleClass23.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());
            assertNull(((IndexedPropertyDescriptor) pd)
                    .getIndexedReadMethod());
            assertEquals(setter, ((IndexedPropertyDescriptor) pd)
                    .getIndexedWriteMethod());
        }
    }
}
 
源代码13 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedSimpleClass48() throws Exception {
    BeanInfo beanInfo = Introspector.getBeanInfo(MixedSimpleClass48.class);
    Method getter = MixedSimpleClass48.class.getMethod("getList",
            new Class<?>[] { int.class });
    assertEquals(2, beanInfo.getPropertyDescriptors().length);
    for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertEquals(getter,
                    ((IndexedPropertyDescriptor) pd).getIndexedReadMethod());
            assertNull(((IndexedPropertyDescriptor) pd)
                    .getIndexedWriteMethod());
        }
    }
}
 
源代码14 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedBooleanSimpleClass11() throws Exception {
    BeanInfo info = Introspector
            .getBeanInfo(MixedBooleanSimpleClass11.class);
    Method setter = MixedBooleanSimpleClass11.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());
        }
    }
}
 
源代码15 项目: TencentKona-8   文件: Test6976577.java
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
 
源代码16 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedBooleanSimpleClass15() throws Exception {
    BeanInfo info = Introspector
            .getBeanInfo(MixedBooleanSimpleClass15.class);
    Method getter = MixedBooleanSimpleClass15.class.getDeclaredMethod(
            "getList", int.class);
    Method setter = MixedBooleanSimpleClass15.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());
        }
    }
}
 
源代码17 项目: java-technology-stack   文件: ExtendedBeanInfo.java
@Nullable
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;
}
 
源代码18 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedSimpleClass34() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedSimpleClass34.class);
    Method indexedGetter = MixedSimpleClass34.class.getDeclaredMethod(
            "getList", int.class);

    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertEquals(indexedGetter, ((IndexedPropertyDescriptor) pd)
                    .getIndexedReadMethod());
            assertNull(((IndexedPropertyDescriptor) pd)
                    .getIndexedWriteMethod());

        }
    }
}
 
源代码19 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedBooleanExtendClass10() throws Exception {
    BeanInfo info = Introspector
            .getBeanInfo(MixedBooleanExtendClass10.class);
    Method setter = MixedBooleanExtendClass10.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;
        }
    }
}
 
源代码20 项目: openjdk-jdk8u   文件: Test6976577.java
public static void main(String[] args) throws Exception {
    Class<?> bt = Accessor.getBeanType();
    Class<?> lt = Accessor.getListenerType();

    // test PropertyDescriptor
    PropertyDescriptor pd = new PropertyDescriptor("boolean", bt);
    test(pd.getReadMethod());
    test(pd.getWriteMethod());

    // test IndexedPropertyDescriptor
    IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor("indexed", bt);
    test(ipd.getReadMethod());
    test(ipd.getWriteMethod());
    test(ipd.getIndexedReadMethod());
    test(ipd.getIndexedWriteMethod());

    // test EventSetDescriptor
    EventSetDescriptor esd = new EventSetDescriptor(bt, "test", lt, "process");
    test(esd.getAddListenerMethod());
    test(esd.getRemoveListenerMethod());
    test(esd.getGetListenerMethod());
    test(esd.getListenerMethods());
}
 
源代码21 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedBooleanExtendClass6() throws Exception {
    BeanInfo info = Introspector
            .getBeanInfo(MixedBooleanExtendClass6.class);
    Method getter = MixedBooleanExtendClass6.class
            .getDeclaredMethod("isList");
    Method setter = MixedBooleanSimpleClass25.class.getDeclaredMethod(
            "setList", boolean.class);

    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertFalse(pd instanceof IndexedPropertyDescriptor);
            assertEquals(getter, pd.getReadMethod());
            assertEquals(setter, pd.getWriteMethod());
            break;
        }
    }
}
 
源代码22 项目: openjdk-jdk9   文件: Test4634390.java
private static PropertyDescriptor create(PropertyDescriptor pd) {
    try {
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            return new IndexedPropertyDescriptor(
                    ipd.getName(),
                    ipd.getReadMethod(),
                    ipd.getWriteMethod(),
                    ipd.getIndexedReadMethod(),
                    ipd.getIndexedWriteMethod());
        } else {
            return new PropertyDescriptor(
                    pd.getName(),
                    pd.getReadMethod(),
                    pd.getWriteMethod());
        }
    }
    catch (IntrospectionException exception) {
        exception.printStackTrace();
        return null;
    }
}
 
源代码23 项目: jdk8u-jdk   文件: Test8034085.java
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
 
源代码24 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedBooleanExtendClass3() throws Exception {
    BeanInfo info = Introspector
            .getBeanInfo(MixedBooleanExtendClass3.class);
    Method getter = MixedBooleanSimpleClass1.class
            .getDeclaredMethod("isList");
    Method setter = MixedBooleanExtendClass3.class.getDeclaredMethod(
            "setList", boolean.class);

    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertFalse(pd instanceof IndexedPropertyDescriptor);
            assertEquals(getter, pd.getReadMethod());
            assertEquals(setter, pd.getWriteMethod());
            break;
        }
    }
}
 
源代码25 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedSimpleClass30() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedSimpleClass30.class);
    Method indexedGetter = MixedSimpleClass30.class.getDeclaredMethod(
            "getList", int.class);

    for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertEquals(indexedGetter, ((IndexedPropertyDescriptor) pd)
                    .getIndexedReadMethod());
            assertNull(((IndexedPropertyDescriptor) pd)
                    .getIndexedWriteMethod());

        }
    }
}
 
源代码26 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedSimpleClass50() throws Exception {
    BeanInfo beanInfo = Introspector.getBeanInfo(MixedSimpleClass50.class);
    Method setter = MixedSimpleClass50.class.getMethod("setList",
            new Class<?>[] { int.class, boolean.class });
    assertEquals(2, beanInfo.getPropertyDescriptors().length);
    for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertNull(((IndexedPropertyDescriptor) pd)
                    .getIndexedReadMethod());
            assertEquals(setter,
                    ((IndexedPropertyDescriptor) pd)
                            .getIndexedWriteMethod());
        }
    }
}
 
源代码27 项目: jdk8u60   文件: Test8034085.java
private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
    PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
    if (pd != null) {
        test(type, "read", read, null != pd.getReadMethod());
        test(type, "write", write, null != pd.getWriteMethod());
        if (pd instanceof IndexedPropertyDescriptor) {
            IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
            test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
            test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
        } else if (readIndexed || writeIndexed) {
            error(type, "indexed property does not exist");
        }
    } else if (read || write || readIndexed || writeIndexed) {
        error(type, "property does not exist");
    }
}
 
源代码28 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedExtendClass10() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedExtendClass10.class);
    Method setter = MixedExtendClass10.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());
            assertNull(((IndexedPropertyDescriptor) pd)
                    .getIndexedReadMethod());
            assertEquals(setter, ((IndexedPropertyDescriptor) pd)
                    .getIndexedWriteMethod());
            break;
        }
    }
}
 
源代码29 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedSimpleClass54() throws Exception {
    BeanInfo beanInfo = Introspector.getBeanInfo(MixedSimpleClass54.class);
    Method setter = MixedSimpleClass54.class.getMethod("setList",
            new Class<?>[] { int.class, boolean.class });
    assertEquals(2, beanInfo.getPropertyDescriptors().length);
    for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
        if (propertyName.equals(pd.getName())) {
            assertNull(pd.getReadMethod());
            assertNull(pd.getWriteMethod());
            assertTrue(pd instanceof IndexedPropertyDescriptor);
            assertNull(((IndexedPropertyDescriptor) pd)
                    .getIndexedReadMethod());
            assertEquals(setter,
                    ((IndexedPropertyDescriptor) pd)
                            .getIndexedWriteMethod());
        }
    }
}
 
源代码30 项目: j2objc   文件: IntrospectorTest.java
public void test_MixedSimpleClass13() throws Exception {
    BeanInfo info = Introspector.getBeanInfo(MixedSimpleClass13.class);
    Method getter = MixedSimpleClass13.class.getDeclaredMethod("getList",
            int.class);
    Method setter = MixedSimpleClass13.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());
        }
    }
}
 
 类所在包
 同包方法