static < T > FieldSetter < T > getFieldSetter ( final Class < T > clazz , String fieldName ) { try { Field field = clazz . getDeclaredField ( fieldName ) ; return new FieldSetter < T > ( field ) ; } catch ( NoSuchFieldException e ) { throw new AssertionError ( e ) ; // programmer error } }
Secret sauce for setting final fields ; don t make it public .