Exemplo n.º 1
0
 void setWriteMethod(java.lang.Class beanClass, String setterName)
 {
     //throws IntrospectionException {
     java.lang.reflect.Method writeMethod = null;
     try
     {
         if (getter != null)
         {
             writeMethod = beanClass.getMethod(setterName,
                     new java.lang.Class[] { getter.getReturnType() });
         }
         else
         {
             java.lang.Class clazz = beanClass;
             java.lang.reflect.Method[] methods = null;
             while (clazz != null && writeMethod == null)
             {
                 methods = clazz.getDeclaredMethods();
                 foreach (java.lang.reflect.Method method in methods)
                 {
                     if (setterName.equals(method.getName()))
                     {
                         if (method.getParameterTypes().Length == 1)
                         {
                             writeMethod = method;
                             break;
                         }
                     }
                 }
                 clazz = clazz.getSuperclass();
             }
         }
     }
     catch (java.lang.Exception e)
     {
         throw new IntrospectionException(e.getLocalizedMessage());
     }
     catch (System.Exception e)
     {
         throw new IntrospectionException(e.Message);
     }
     if (writeMethod == null)
     {
         throw new IntrospectionException("Method not found: " + setterName); //$NON-NLS-1$
     }
     setWriteMethod(writeMethod);
 }
Exemplo n.º 2
0
 void setReadMethod(java.lang.Class beanClass, String getterName)
 {
     //throws IntrospectionException {
     try
     {
         java.lang.reflect.Method readMethod = beanClass.getMethod(getterName, new java.lang.Class[] { });
         setReadMethod(readMethod);
     }
     catch (java.lang.Exception e)
     {
         throw new IntrospectionException(e.getLocalizedMessage());
     }
     catch (System.Exception e)
     {
         throw new IntrospectionException(e.getMessage());
     }
 }