dimanche 2 août 2015

What is a clean way to construct strings with java code?

I am trying to inject some additional code to each method using a Java agent. So far I am writing the code something like this:

String signature = method.getSignature();
method.insertBefore("System.err.println(\"" + signature + "\");");

Is there a cleaner way of writing Java syntax? Something similar to the one available for SQL would be useful.

Update: For example, to create System.err.println, something like createClass("System").createField("out").createMethod("println").





Aucun commentaire:

Enregistrer un commentaire