public static void setFieldValue ( Object target , String fieldName , Object value ) { try { Field field = target . getClass ( ) . getDeclaredField ( fieldName ) ; field . setAccessible ( true ) ; field . set ( target , value ) ; } catch ( NoSuchFieldException e ) { throw handleException ( fieldName , e ) ; } catch ( IllegalAccessException e ) { throw handleException ( fieldName , e ) ; } }
Set target object field value