junit-servers-core/src/main/java/com/github/mjeanroy/junit/servers/commons/ReflectionUtils.java
@SuppressWarnings("unchecked")
	public static <T> T getter(Object target, Field field) {
		boolean forceAccess = false;

		try {
			if (!field.isAccessible()) {
				field.setAccessible(true);
				forceAccess = true;
			}

			return (T) field.get(target);
		}
		catch (IllegalAccessException ex) {
			throw new ReflectionException(ex);
		}
		finally {
			if (forceAccess) {
				field.setAccessible(false);
			}
		}
	}
@SuppressWarnings("unchecked")
	public static <T> T getter(Object target, Field field) {
		boolean forceAccess = false;

		try {
			if (!field.isAccessible()) {
				field.setAccessible(true);
				forceAccess = true;
			}

			return (T) field.get(target);
		}
		catch (IllegalAccessException ex) {
			throw new ReflectionException(ex);
		}
		finally {
			if (forceAccess) {
				field.setAccessible(false);
			}
		}
	}
@ SuppressWarnings ( "unchecked" ) public static < T > T getter ( Object target , Field field ) { boolean forceAccess = false ; try { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; forceAccess = true ; } return ( T ) field . get ( target ) ; } catch ( IllegalAccessException ex ) { throw new ReflectionException ( ex ) ; } finally { if ( forceAccess ) { field . setAccessible ( false ) ; } } }
Get value of field on target object.
If target is null, it means that field is static and do not
need any target instance.

@param target Target object.
@param field Field.
@param <T> Type of expected value.
@return Field value.
Get value of field on target object . If target is null it means that field is static and do not need any target instance .