public static void setObjectProperty ( final Object obj , final String propertyName , final String propertyValue , final boolean ignoreNonExisting ) { try { String methodName = "set" + Character . toUpperCase ( propertyName . charAt ( 0 ) ) + propertyName . substring ( 1 ) ; AttributesType parameterType = matchParaMeterOfMethod ( obj , methodName ) ; if ( parameterType != null ) { Method method = obj . getClass ( ) . getMethod ( methodName , new Class [ ] { parameterType . clazz } ) ; method . invoke ( obj , convertToObject ( parameterType , propertyValue ) ) ; } } catch ( Exception e ) { String msg = "failed to set property '" + propertyName + "' to value '" + propertyValue + "' for object " + obj ; if ( ignoreNonExisting ) { LOG . log ( Level . FINE , msg , e ) ; } else { LOG . warning ( msg ) ; throw new IllegalArgumentException ( e ) ; } } }
set object property .