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;
}
}
}
use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IntrospectorTest method test_MixedSimpleClass60.
public void test_MixedSimpleClass60() throws Exception {
BeanInfo beanInfo = Introspector.getBeanInfo(MixedSimpleClass60.class);
Method getter = MixedSimpleClass60.class.getMethod("getList", new Class<?>[] { int.class });
Method setter = MixedSimpleClass60.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());
}
}
}
use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IntrospectorTest method test_MixedBooleanExtendClass5.
public void test_MixedBooleanExtendClass5() throws Exception {
BeanInfo info = Introspector.getBeanInfo(MixedBooleanExtendClass5.class);
Method getter = MixedBooleanSimpleClass1.class.getDeclaredMethod("isList");
for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
if (propertyName.equals(pd.getName())) {
assertFalse(pd instanceof IndexedPropertyDescriptor);
assertEquals(getter, pd.getReadMethod());
assertNull(pd.getWriteMethod());
break;
}
}
}
use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IndexedPropertyDescriptorTest method testSetIndexedReadMethod_RInvalidArgs.
/*
* indexed read method without args
*/
public void testSetIndexedReadMethod_RInvalidArgs() throws SecurityException, NoSuchMethodException, IntrospectionException {
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);
assertSame(indexedReadMethod, ipd.getIndexedReadMethod());
try {
ipd.setIndexedReadMethod(readMethod);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
use of java.beans.IndexedPropertyDescriptor in project j2objc by google.
the class IndexedPropertyDescriptorTest method testIndexedPropertyDescriptorStringClassStringStringStringString_RWIncompatible.
/*
* read/write incompatible
*
*/
public void testIndexedPropertyDescriptorStringClassStringStringStringString_RWIncompatible() throws IntrospectionException {
String propertyName = "PropertyFour";
String anotherProp = "PropertyFive";
Class<MockJavaBean> beanClass = MockJavaBean.class;
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(propertyName, beanClass, "get" + propertyName, "set" + anotherProp, "get" + propertyName, "set" + propertyName);
assertEquals(String.class, ipd.getIndexedPropertyType());
assertEquals(String[].class, ipd.getPropertyType());
assertEquals("set" + anotherProp, ipd.getWriteMethod().getName());
}
Aggregations