通过反射获取给定实例上的field的值
/* from 时代Java - nowjava.com */ import javax.ws.rs.core.MultivaluedMap; import java.lang.reflect.Field; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; public class Main{ /** * Gets the value of field on the given instance * @param field the field * @param instance the object instance * @return the value */ public static Object getFieldValue(Field field, Object instance) { try { field.setAccessible(true); return field.get(instance);/*来自 n o w j a v a . c o m - 时 代 Java*/ }