Skip to content

Instantly share code, notes, and snippets.

@leonardosnt
Last active May 11, 2016 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonardosnt/3d2ef8f3e94b50b5206ab3529f4d8014 to your computer and use it in GitHub Desktop.
Save leonardosnt/3d2ef8f3e94b50b5206ab3529f4d8014 to your computer and use it in GitHub Desktop.
float f = Methods.from(this).find("xisde").invoke();
//Normal
java.lang.reflect.Method md = getClass().getDeclaredMethod("xisde");
md.setAccessible(true);
float x = (float) md.invoke(this);
int f = Methods
.from(this)
.find("xisde") // return java.lang.Float
.invokeAsMethods()
.find("intValue")
.invoke();
Methods
.from(this)
.find("xisde") // return java.lang.Float
.then(m -> {
System.out.println(Modifier.toString(m.getModifiers()));
m.setModifiers((m.getModifiers() & ~Modifier.PRIVATE) | Modifier.PUBLIC);
System.out.println(Modifier.toString(m.getModifiers()));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment