diff options
author | marten.hedborg <marten.hedborg@gmail.com> | 2015-03-15 20:05:44 +0100 |
---|---|---|
committer | marten.hedborg <marten.hedborg@gmail.com> | 2015-03-15 20:05:44 +0100 |
commit | aa3037a417180f938c51a4feae23e2dc50b9e836 (patch) | |
tree | b86ab1bd1eae4477da178b66df7b44fd3531283b | |
parent | 89e50989d08c15ee15efe6c8427e56b97c572317 (diff) | |
download | javassist-aa3037a417180f938c51a4feae23e2dc50b9e836.tar.gz javassist-aa3037a417180f938c51a4feae23e2dc50b9e836.zip |
Better javadoc for Callback class
-rw-r--r-- | src/main/javassist/tools/Callback.java | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/main/javassist/tools/Callback.java b/src/main/javassist/tools/Callback.java index 4a1a491f..96728913 100644 --- a/src/main/javassist/tools/Callback.java +++ b/src/main/javassist/tools/Callback.java @@ -9,8 +9,26 @@ import java.util.UUID; /** * Creates bytecode that when executed calls back to the instance's result method. * - * Inserts callbacks in <code>CtBehaviour</code> - * + * Example of how to create and insert a callback: + * <pre>{@code + * ctMethod.insertAfter(new Callback("Thread.currentThread()") { + * @literal@Override + * public void result(Object... objects) { + * Thread thread = (Thread) objects[0]; + * // do something with thread... + * } + * }.sourceCode()); + * }</pre> + * Contains utility methods for inserts callbacks in <code>CtBehaviour</code>, example: + * <pre>{@code + * insertAfter(ctBehaviour, new Callback("Thread.currentThread(), dummyString") { + * @literal@Override + * public void result(Object... objects) { + * Thread thread = (Thread) objects[0]; + * // do something with thread... + * } + * }); + * }</pre> */ public abstract class Callback { @@ -22,8 +40,8 @@ public abstract class Callback { * Constructs a new <code>Callback</code> object. * * @param src The source code representing the inserted callback bytecode. - * Can be one or many single statements or blocks each returning one object. - * If many single statements or blocks are used they must be comma separated. + * Can be one or many single statements each returning one object. + * If many single statements are used they must be comma separated. */ public Callback(String src){ String uuid = UUID.randomUUID().toString(); @@ -48,7 +66,7 @@ public abstract class Callback { } /** - * Inserts callback at the beginning of the body. + * Utility method to insert callback at the beginning of the body. * * @param callback The callback * @@ -61,7 +79,7 @@ public abstract class Callback { } /** - * Inserts callback at the end of the body. + * Utility method to inserts callback at the end of the body. * The callback is inserted just before every return instruction. * It is not executed when an exception is thrown. * @@ -77,7 +95,7 @@ public abstract class Callback { } /** - * Inserts callback at the end of the body. + * Utility method to inserts callback at the end of the body. * The callback is inserted just before every return instruction. * It is not executed when an exception is thrown. * @@ -98,7 +116,7 @@ public abstract class Callback { } /** - * Inserts callback at the specified line in the body. + * Utility method to inserts callback at the specified line in the body. * * @param behavior The behaviour to insert callback in * @param callback The callback representing. |