use of java.beans.BeanDescriptor in project j2objc by google.
the class IntrospectorTest method testBeanInfo_1.
/*
* Test Introspection with BeanInfo No immediate BeanInfo Have super
* BeanInfo
*/
public void testBeanInfo_1() throws IntrospectionException {
Class<FakeFox011> beanClass = FakeFox011.class;
BeanInfo info = Introspector.getBeanInfo(beanClass);
assertNull(info.getAdditionalBeanInfo());
BeanDescriptor beanDesc = info.getBeanDescriptor();
assertEquals("FakeFox011", beanDesc.getName());
assertEquals(0, info.getEventSetDescriptors().length);
assertEquals(-1, info.getDefaultEventIndex());
assertEquals(0, info.getDefaultPropertyIndex());
MethodDescriptor[] methodDesc = info.getMethodDescriptors();
assertEquals(4, methodDesc.length);
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
assertEquals(2, propertyDesc.length);
for (PropertyDescriptor element : propertyDesc) {
if (element.getName().equals("class")) {
assertNull(element.getWriteMethod());
assertNotNull(element.getReadMethod());
}
}
}
use of java.beans.BeanDescriptor in project j2objc by google.
the class IntrospectorTest method testBeanInfo_2.
public void testBeanInfo_2() throws IntrospectionException {
Class<FakeFox02> beanClass = FakeFox02.class;
BeanInfo info = Introspector.getBeanInfo(beanClass);
assertNull(info.getAdditionalBeanInfo());
BeanDescriptor beanDesc = info.getBeanDescriptor();
assertEquals("FakeFox02", beanDesc.getName());
assertEquals(0, info.getEventSetDescriptors().length);
assertEquals(-1, info.getDefaultEventIndex());
assertEquals(-1, info.getDefaultPropertyIndex());
PropertyDescriptor[] propertyDesc = info.getPropertyDescriptors();
for (PropertyDescriptor element : propertyDesc) {
if (element.getName().equals("fox02")) {
assertEquals("fox02.beaninfo", element.getDisplayName());
}
}
}
use of java.beans.BeanDescriptor in project j2objc by google.
the class IntrospectorTest method testSetBeanInfoSearchPath_SameClassesInDifferentPackage.
/*
* @test setBeanInfoSearchPath
*
* Change the sequence of the paths in Introspector.searchpaths, check
* whether the BeanInfo is consistent with the bean class
*/
public void testSetBeanInfoSearchPath_SameClassesInDifferentPackage() throws IntrospectionException {
// set the search path in the correct sequence
Introspector.setBeanInfoSearchPath(new String[] { "org.apache.harmony.beans.tests.support.mock.homonymy.mocksubject1.info", "org.apache.harmony.beans.tests.support.mock.homonymy.mocksubject2.info" });
BeanInfo beanInfo = Introspector.getBeanInfo(org.apache.harmony.beans.tests.support.mock.homonymy.mocksubject1.MockHomonymySubject.class);
BeanDescriptor beanDesc = beanInfo.getBeanDescriptor();
assertEquals(beanDesc.getName(), "mocksubject1");
assertEquals(beanDesc.getBeanClass(), org.apache.harmony.beans.tests.support.mock.homonymy.mocksubject1.MockHomonymySubject.class);
// set the search path in the reverse sequence
Introspector.setBeanInfoSearchPath(new String[] { "org.apache.harmony.beans.tests.support.mock.homonymy.mocksubject2.info", "org.apache.harmony.beans.tests.support.mock.homonymy.mocksubject1.info" });
beanInfo = Introspector.getBeanInfo(org.apache.harmony.beans.tests.support.mock.homonymy.mocksubject1.MockHomonymySubject.class);
beanDesc = beanInfo.getBeanDescriptor();
assertEquals(beanDesc.getName(), "mocksubject1");
assertEquals(beanDesc.getBeanClass(), org.apache.harmony.beans.tests.support.mock.homonymy.mocksubject1.MockHomonymySubject.class);
}
use of java.beans.BeanDescriptor in project jdk8u_jdk by JetBrains.
the class Foo method getBeanDescriptor.
public BeanDescriptor getBeanDescriptor() {
BeanDescriptor bd = new BeanDescriptor(Foo.class);
// set a value to ensure that it's unique
bd.setValue("test", Boolean.TRUE);
return bd;
}
use of java.beans.BeanDescriptor in project jdk8u_jdk by JetBrains.
the class WombatBeanInfo method getBeanDescriptor.
public BeanDescriptor getBeanDescriptor() {
BeanDescriptor bd = new BeanDescriptor(Wombat.class);
// set a value to ensure that it's unique
bd.setValue("test", Boolean.TRUE);
return bd;
}
Aggregations