Java tutorial
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Field; public class Main { public static Field fieldGetOrg(Object object, String name) throws Exception { Field field = object.getClass().getDeclaredField(name); field.setAccessible(true); return field; } public static Field fieldGetOrg(Object object, Class<?> clazz, String name) throws Exception { Field field = clazz.getDeclaredField(name); field.setAccessible(true); return field; } }