當前位置: 首頁>>代碼示例>>Java>>正文


Java IndexedPropertyDescriptor.setIndexedWriteMethod方法代碼示例

本文整理匯總了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());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:22,代碼來源:IndexedPropertyDescriptorTest.java

示例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());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:21,代碼來源:IndexedPropertyDescriptorTest.java

示例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) {
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:23,代碼來源:IndexedPropertyDescriptorTest.java

示例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) {
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:25,代碼來源:IndexedPropertyDescriptorTest.java

示例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());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:25,代碼來源:IndexedPropertyDescriptorTest.java


注:本文中的java.beans.IndexedPropertyDescriptor.setIndexedWriteMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。