private void callSetter ( Object target , PropertyDescriptor prop , Object value ) throws SQLException { Method setter = getWriteMethod ( target , prop , value ) ; if ( setter == null || setter . getParameterTypes ( ) . length != 1 ) { return ; } try { Class < ? > firstParam = setter . getParameterTypes ( ) [ 0 ] ; for ( PropertyHandler handler : propertyHandlers ) { if ( handler . match ( firstParam , value ) ) { value = handler . apply ( firstParam , value ) ; break ; } } // Don't call setter if the value object isn't the right type if ( this . isCompatibleType ( value , firstParam ) ) { setter . invoke ( target , new Object [ ] { value } ) ; } else { throw new SQLException ( "Cannot set " + prop . getName ( ) + ": incompatible types, cannot convert " + value . getClass ( ) . getName ( ) + " to " + firstParam . getName ( ) ) ; // value cannot be null here because isCompatibleType allows null } } catch ( IllegalArgumentException e ) { throw new SQLException ( "Cannot set " + prop . getName ( ) + ": " + e . getMessage ( ) ) ; } catch ( IllegalAccessException e ) { throw new SQLException ( "Cannot set " + prop . getName ( ) + ": " + e . getMessage ( ) ) ; } catch ( InvocationTargetException e ) { throw new SQLException ( "Cannot set " + prop . getName ( ) + ": " + e . getMessage ( ) ) ; } }
Calls the setter method on the target object for the given property . If no setter method exists for the property this method does nothing .