Java tutorial
//package com.java2s; import java.lang.reflect.Field; public class Main { public static void setFieldValue(Class<?> fieldClass, String fieldName, Object instance, Object value) { try { Field e = fieldClass.getDeclaredField(fieldName); e.setAccessible(true); e.set(instance, value); } catch (Exception var5) { var5.printStackTrace(); } } }