Package java.beans

Examples of java.beans.IndexedPropertyDescriptor


        for (PropertyDescriptor element : propertyDesc) {
            if (element.getName().equals("class")) {
                assertNull(element.getWriteMethod());
                assertNotNull(element.getReadMethod());
            } else {
                IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) element;
                assertEquals("fox501", element.getName());
                assertEquals(String[].class.getName(), element
                        .getPropertyType().getName());
                assertNull(element.getWriteMethod());
                assertNotNull(element.getReadMethod());
                assertNull(indexedDesc.getIndexedReadMethod());
                assertNotNull(indexedDesc.getIndexedWriteMethod());
                assertEquals(String.class.getName(), indexedDesc
                        .getIndexedPropertyType().getName());
            }
        }
    }
View Full Code Here


        for (PropertyDescriptor element : propertyDesc) {
            if (element.getName().equals("class")) {
                assertNull(element.getWriteMethod());
                assertNotNull(element.getReadMethod());
            } else {
                IndexedPropertyDescriptor indexedDesc = (IndexedPropertyDescriptor) element;
                assertEquals("fox501", element.getName());
                assertNull(element.getPropertyType());
                assertNull(element.getWriteMethod());
                assertNull(element.getReadMethod());
                assertNull(indexedDesc.getIndexedReadMethod());
                assertNotNull(indexedDesc.getIndexedWriteMethod());
                assertEquals(Integer.class.getName(), indexedDesc
                        .getIndexedPropertyType().getName());
            }
        }
    }
View Full Code Here

    public Object get(Object obj, int i)
        throws InvocationTargetException, IllegalAccessException {
        if (!isIndexed()) {
            return Array.get(get(obj), i);
        } else {
            IndexedPropertyDescriptor id = (IndexedPropertyDescriptor)myPD;
            return id.getIndexedReadMethod().invoke(obj,
                                                    new Object[] {
                                                        new Integer(i)});
        }
    }
View Full Code Here

     */
    public void set(Object obj, int i, Object newValue)
        throws InvocationTargetException, IllegalAccessException {
        // Set the new value
        if (isIndexed()) {
            IndexedPropertyDescriptor id = (IndexedPropertyDescriptor)myPD;
            growArrayToSize(obj, id.getIndexedPropertyType(), i);
            id.getIndexedWriteMethod().invoke(obj,
                                              new Object[] {
                                                  new Integer(i), newValue});
        } else {
            Array.set(get(obj), i, newValue);
        }
View Full Code Here

                addDesc = false; // Already present, so don't add it again
            }
            Class type;
            boolean isCollection = false;
            if (propDesc instanceof IndexedPropertyDescriptor) {
                IndexedPropertyDescriptor iProp =
                        (IndexedPropertyDescriptor)propDesc;
                beanDesc.setIndexedReadMethod(iProp.getIndexedReadMethod());
                beanDesc.setIndexedWriteMethod(iProp.getIndexedWriteMethod());
                type = iProp.getIndexedPropertyType();
                elDesc.setIndexedAccessor(beanDesc);
                isCollection = true;
            } else {
                type = propDesc.getPropertyType();
                // TODO : check if this is a supported collection type
View Full Code Here

                addDesc = false; // Already present, so don't add it again
            }
            Class type;
            boolean isCollection = false;
            if (propDesc instanceof IndexedPropertyDescriptor) {
                IndexedPropertyDescriptor iProp =
                        (IndexedPropertyDescriptor)propDesc;
                beanDesc.setIndexedReadMethod(iProp.getIndexedReadMethod());
                beanDesc.setIndexedWriteMethod(iProp.getIndexedWriteMethod());
                type = iProp.getIndexedPropertyType();
                elDesc.setIndexedAccessor(beanDesc);
                isCollection = true;
//                elDesc.setItemQName(new QName("http://foo", "item"));
            } else {
                type = propDesc.getPropertyType();
View Full Code Here

      PropertyDescriptor [] pds = mBeanInfo.getPropertyDescriptors ();
      for (int i = 0; pds != null && i < pds.length; i++) {
  // Treat as both an indexed property and a normal property
  PropertyDescriptor pd = pds [i];
  if (pd instanceof IndexedPropertyDescriptor) {
    IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
    Method readMethod = getPublicMethod (ipd.getIndexedReadMethod ());
    Method writeMethod = getPublicMethod (ipd.getIndexedWriteMethod ());
    BeanInfoIndexedProperty property = new BeanInfoIndexedProperty
      (readMethod,
       writeMethod,
       ipd);

    mIndexedPropertyByName.put (ipd.getName (), property);
  }

  Method readMethod = getPublicMethod (pd.getReadMethod ());
  Method writeMethod = getPublicMethod (pd.getWriteMethod ());
  BeanInfoProperty property = new BeanInfoProperty
View Full Code Here

                break;
            }
        }
        assertNotNull(pd);
        assertTrue(pd instanceof IndexedPropertyDescriptor);
        IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
        assertNull(ipd.getReadMethod());
        assertNull(ipd.getWriteMethod());
        Method indexedReadMethod = beanClass.getMethod("getData",
                new Class[] { int.class });
        Method indexedWriteMethod = beanClass.getMethod("setData", new Class[] {
                int.class, int.class });
        assertEquals(indexedReadMethod, ipd.getIndexedReadMethod());
        assertEquals(indexedWriteMethod, ipd.getIndexedWriteMethod());
    }
View Full Code Here

                break;
            }
        }
        assertNotNull(pd);
        assertTrue(pd instanceof IndexedPropertyDescriptor);
        IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
        assertNull(ipd.getReadMethod());
        assertNull(ipd.getWriteMethod());
        Method indexedReadMethod = beanClass.getMethod("getData",
                new Class[] { int.class });
        Method indexedWriteMethod = beanClass.getMethod("setData", new Class[] {
                int.class, int.class });
        assertEquals(indexedReadMethod, ipd.getIndexedReadMethod());
        assertEquals(indexedWriteMethod, ipd.getIndexedWriteMethod());
    }
View Full Code Here

                break;
            }
        }
        assertNotNull(pd);
        assertTrue(pd instanceof IndexedPropertyDescriptor);
        IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
        assertNull(ipd.getReadMethod());
        assertNull(ipd.getWriteMethod());
        Method indexedReadMethod = beanClass.getMethod("getData",
                new Class[] { int.class });
        Method indexedWriteMethod = beanClass.getMethod("setData", new Class[] {
                int.class, int.class });
        assertEquals(indexedReadMethod, ipd.getIndexedReadMethod());
        assertEquals(indexedWriteMethod, ipd.getIndexedWriteMethod());
    }
View Full Code Here

TOP

Related Classes of java.beans.IndexedPropertyDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.