public static boolean setField ( Object target , String name , Object value ) { try { Field field = target . getClass ( ) . getDeclaredField ( name ) ; field . setAccessible ( true ) ; field . set ( target , value ) ; return true ; } catch ( NoSuchFieldException e ) { return false ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Set the field identified by name to the given value .