private static Method getWriteMethod(Object object, String propertyName) {
        String methodName = "set"
            + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1);
        Method[] methods = getMethods(object);

        for (Method method : methods) {
            if (method.getName().equals(methodName) && (method.getParameterTypes().length == 1)) {
                return method;
            }
        }
        return null;
    }
private static Method getWriteMethod(Object object, String propertyName) {
        String methodName = "set"
            + propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1);
        Method[] methods = getMethods(object);

        for (Method method : methods) {
            if (method.getName().equals(methodName) && (method.getParameterTypes().length == 1)) {
                return method;
            }
        }
        return null;
    }
private static Method getWriteMethod ( Object object , String propertyName ) { String methodName = "set" + propertyName . substring ( 0 , 1 ) . toUpperCase ( Locale . ENGLISH ) + propertyName . substring ( 1 ) ; Method [ ] methods = getMethods ( object ) ; for ( Method method : methods ) { if ( method . getName ( ) . equals ( methodName ) && ( method . getParameterTypes ( ) . length == 1 ) ) { return method ; } } return null ; }
Tries to find the Java method to write a new value for a given propertyName to the given object.
@param object the object whose class will be examined
@param propertyName the property name for which the write method is to be searched
@return the {@link Method} if found, null in all other cases.
Tries to find the Java method to write a new value for a given propertyName to the given object .