Code example for Field

Methods: setAccessiblegetModifiersset

0
    } 
 
    public static void setStaticValue(Class<?> clazz, String fieldName, Object value) {
        try { 
            Field field = clazz.getField(fieldName);
            field.setAccessible(true);
 
            Field modifiersField = Field.class.getDeclaredField("modifiers");
            modifiersField.setAccessible(true);
            modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
 
            field.set(null, value);
        } catch (Exception e) {
            throw new RuntimeException(e);
        } 
    } 
 
    protected void delegateLoadingOf(final String className) {
        classLoader.delegateLoadingOf(className);
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE