Here you can find the source of setFieldValue(String name, String obfuscatedName, Class> clazz, Object object, Object value)
public static void setFieldValue(String name, String obfuscatedName, Class<?> clazz, Object object, Object value)
//package com.java2s; import java.lang.reflect.Field; public class Main { public static void setFieldValue(String name, String obfuscatedName, Class<?> clazz, Object object, Object value) {// www. j av a 2 s. c om Field field = getField(name, obfuscatedName, clazz); try { field.setAccessible(true); field.set(object, value); } catch (Exception e) { throw new RuntimeException(e); } } public static Field getField(String name, String obfuscatedName, Class<?> clazz) { try { return clazz.getDeclaredField(name); } catch (NoSuchFieldException e1) { if (obfuscatedName == null) { throw new RuntimeException("No obfuscated field name provided."); } try { return clazz.getDeclaredField(obfuscatedName); } catch (NoSuchFieldException e2) { } } throw new RuntimeException("Cannot find field: " + name); } }