本文整理匯總了Java中java.beans.IndexedPropertyDescriptor.setIndexedWriteMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java IndexedPropertyDescriptor.setIndexedWriteMethod方法的具體用法?Java IndexedPropertyDescriptor.setIndexedWriteMethod怎麽用?Java IndexedPropertyDescriptor.setIndexedWriteMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.beans.IndexedPropertyDescriptor
的用法示例。
在下文中一共展示了IndexedPropertyDescriptor.setIndexedWriteMethod方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSetIndexedWriteMethod_null
import java.beans.IndexedPropertyDescriptor; //導入方法依賴的package包/類
public void testSetIndexedWriteMethod_null() throws IntrospectionException,
NoSuchMethodException, NoSuchMethodException {
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(indexedWriteMethod, ipd.getIndexedWriteMethod());
ipd.setIndexedWriteMethod(null);
assertNull(ipd.getIndexedWriteMethod());
}
示例2: testSetIndexedWriteMethod
import java.beans.IndexedPropertyDescriptor; //導入方法依賴的package包/類
public void testSetIndexedWriteMethod() throws IntrospectionException,
NoSuchMethodException, NoSuchMethodException {
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, null);
assertNull(ipd.getIndexedWriteMethod());
ipd.setIndexedWriteMethod(indexedWriteMethod);
assertSame(indexedWriteMethod, ipd.getIndexedWriteMethod());
}
示例3: testSetIndexedWriteMethod_noargs
import java.beans.IndexedPropertyDescriptor; //導入方法依賴的package包/類
public void testSetIndexedWriteMethod_noargs()
throws IntrospectionException, NoSuchMethodException,
NoSuchMethodException {
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 });
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(
propertyName, readMethod, writeMethod, indexedReadMethod, null);
assertNull(ipd.getIndexedWriteMethod());
try {
ipd.setIndexedWriteMethod(indexedReadMethod);
fail("Should throw IntrospectionException.");
} catch (IntrospectionException e) {
}
}
示例4: testSetIndexedWriteMethod_badargtype
import java.beans.IndexedPropertyDescriptor; //導入方法依賴的package包/類
public void testSetIndexedWriteMethod_badargtype()
throws IntrospectionException, NoSuchMethodException,
NoSuchMethodException {
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 });
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(
propertyName, readMethod, writeMethod, indexedReadMethod, null);
assertNull(ipd.getIndexedWriteMethod());
Method badArgType = beanClass.getMethod("set" + propertyName,
new Class[] { Integer.TYPE, Integer.TYPE });
try {
ipd.setIndexedWriteMethod(badArgType);
fail("Should throw IntrospectionException");
} catch (IntrospectionException e) {
}
}
示例5: testSetIndexedWriteMethod_return
import java.beans.IndexedPropertyDescriptor; //導入方法依賴的package包/類
public void testSetIndexedWriteMethod_return()
throws IntrospectionException, NoSuchMethodException,
NoSuchMethodException {
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 });
IndexedPropertyDescriptor ipd = new IndexedPropertyDescriptor(
propertyName, readMethod, writeMethod, indexedReadMethod, null);
assertNull(ipd.getIndexedWriteMethod());
Method badArgType = beanClass.getMethod("setPropertyFourInvalid",
new Class[] { Integer.TYPE, String.class });
ipd.setIndexedWriteMethod(badArgType);
assertEquals(String.class, ipd.getIndexedPropertyType());
assertEquals(String[].class, ipd.getPropertyType());
assertEquals(Integer.TYPE, ipd.getIndexedWriteMethod().getReturnType());
}