Skip to content

Instantly share code, notes, and snippets.

@torstenwerner
Created January 11, 2017 13:30
Show Gist options
  • Save torstenwerner/a89b206b7264f35e1d4db55d6c86b6c1 to your computer and use it in GitHub Desktop.
Save torstenwerner/a89b206b7264f35e1d4db55d6c86b6c1 to your computer and use it in GitHub Desktop.
invoke java method dynamically in groovy code
def iClass = 'java.lang.Integer' as Class
assert iClass.newInstance(26) == 26
def greeting = 'Hello'
def method = 'length'
assert greeting."$method"() == 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment