Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Content coupling example
Class<?> clazz = Image.class;
Object imageInstance = clazz.newInstance();
Field descriptionField = imageInstance
.getClass().getDeclaredField("description");
descriptionField.setAccessible(true);
descriptionField
.set(imageInstance, "Pen Pineapple Apple Pen");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment