0

How to (programmatically) add expression to existing method?

I'm trying to generate class with main method with "System.out.println("Hello world")" inside.

How to add this expression, "System.out.println("Hello world")", to existing node<StaticMethodDeclaration> mainMethod?

I created everything up to DotExpression. It requires to create operand and operation. Operand is StaticFieldReference to System.out, and operation is InstanceMethodCallOperation to println, and I have now clue how to create this references :(

Can you show some code? Or, at least, point to right examples?

Thank you

2 comments

Please sign in to leave a comment.