Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; public class Main { static Field getField(Class clazz, String fieldName) { try { final Field f = clazz.getDeclaredField(fieldName); f.setAccessible(true); return f; } catch (NoSuchFieldException ignored) { } return null; } }