Skip to content

Instantly share code, notes, and snippets.

@olegchir
Created July 16, 2018 12:26
Show Gist options
  • Save olegchir/a56bd93c7329ec3c20579b0089f82b6d to your computer and use it in GitHub Desktop.
Save olegchir/a56bd93c7329ec3c20579b0089f82b6d to your computer and use it in GitHub Desktop.
def clazz = new MethodCallExpression(new VariableExpression("this"), "getClass", EMPTY_ARGUMENTS)
def body = new ExpressionStatement(new MethodCallExpression(clazz, "getName", EMPTY_ARGUMENTS))
classNode.addMethod('getDescription', ACC_PUBLIC, STRING_TYPE, EMPTY_ARRAY, ClassNode.EMPTY_ARRAY, body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment