public static void setField(final Object object, final String fieldName, final Object fieldNewValue) {
    try {
      traverseClassHierarchy(object.getClass(), NoSuchFieldException.class, new InsideTraversal<Void>() {
        @Override
        public Void run(Class<?> traversalClass) throws Exception {
          Field field = traversalClass.getDeclaredField(fieldName);
          field.setAccessible(true);
          field.set(object, fieldNewValue);
          return null;
        }
      });
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
public static void setField(final Object object, final String fieldName, final Object fieldNewValue) {
    try {
      traverseClassHierarchy(object.getClass(), NoSuchFieldException.class, new InsideTraversal<Void>() {
        @Override
        public Void run(Class<?> traversalClass) throws Exception {
          Field field = traversalClass.getDeclaredField(fieldName);
          field.setAccessible(true);
          field.set(object, fieldNewValue);
          return null;
        }
      });
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
public static void setField ( final Object object , final String fieldName , final Object fieldNewValue ) { try { traverseClassHierarchy ( object . getClass ( ) , NoSuchFieldException . class , new InsideTraversal < Void > ( ) { @ Override public Void run ( Class < ? > traversalClass ) throws Exception { Field field = traversalClass . getDeclaredField ( fieldName ) ; field . setAccessible ( true ) ; field . set ( object , fieldNewValue ) ; return null ; } } ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Reflectively set the value of a field.

@param object Target object.
@param fieldName The field name.
@param fieldNewValue New value.
Reflectively set the value of a field .