public void setReadMethod(java.lang.reflect.Method getter) {//throws IntrospectionException { if (getter != null) { int modifiers = getter.getModifiers(); if (!java.lang.reflect.Modifier.isPublic(modifiers)) { throw new IntrospectionException("Modifier for getter method should be public.");//Messages.getString("beans.0A")); //$NON-NLS-1$ } java.lang.Class[] parameterTypes = getter.getParameterTypes(); if (parameterTypes.Length != 0) { throw new IntrospectionException("Number of parameters in getter method is not equal to 0.");//Messages.getString("beans.08")); //$NON-NLS-1$ } java.lang.Class returnType = getter.getReturnType(); if (returnType.equals(java.lang.Void.TYPE)) { throw new IntrospectionException("{0} does not return <void>");//Messages.getString("beans.33")); //$NON-NLS-1$ } java.lang.Class propertyType = getPropertyType(); if ((propertyType != null) && !returnType.equals(propertyType)) { throw new IntrospectionException("Parameter type in getter method does not corresponds to predefined.");//Messages.getString("beans.09")); //$NON-NLS-1$ } } this.getter = getter; }
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); }