Java examples for Reflection:Modifier
remove Final Modifier
//package com.java2s; import java.lang.reflect.Field; import java.lang.reflect.Modifier; public class Main { public static void removeFinalModifier(final Field field) throws Exception { field.setAccessible(true);//from w w w . j ava 2 s . c om final Field modifiersField = Field.class .getDeclaredField("modifiers"); modifiersField.setAccessible(true); modifiersField .setInt(field, field.getModifiers() & ~Modifier.FINAL); } }