aboutsummaryrefslogtreecommitdiffstats
path: root/tutorial/tutorial2.html
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-08-04 15:47:33 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-08-04 15:47:33 +0000
commitd96924c601912c7df55e378806a126850a798eaa (patch)
tree1be4090c1e6ca1bf8c6bf5dfbaac40360c2aaa15 /tutorial/tutorial2.html
parent4fc98e20925d92a81cb8e2076886c841993af1c5 (diff)
downloadjavassist-d96924c601912c7df55e378806a126850a798eaa.tar.gz
javassist-d96924c601912c7df55e378806a126850a798eaa.zip
updated some javadoc comments.
modified Loader so that getPackage() works. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@32 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'tutorial/tutorial2.html')
-rw-r--r--tutorial/tutorial2.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/tutorial/tutorial2.html b/tutorial/tutorial2.html
index 31d75f0b..13574c96 100644
--- a/tutorial/tutorial2.html
+++ b/tutorial/tutorial2.html
@@ -23,6 +23,32 @@ the Java reflection API. <code>CtClass</code> provides
definition. It allows to add a new field, constructor, and method.
Instrumenting a method body is also possible.
+<p>
+Methods are represented by <code>CtMethod</code> objects.
+<code>CtMethod</code> provides several methods for modifying
+the definition of the method. Note that if a method is inherited
+from a super class, then
+the same <code>CtMethod</code> object
+that represents the inherited method represents the method declared
+in that super class.
+A <code>CtMethod</code> object corresponds to every method declaration.
+
+<p>
+For example, if class <code>Point</code> declares method <code>move()</code>
+and a subclass <code>ColorPoint</code> of <code>Point</code> does
+not override <code>move()</code>, the two <code>move()</code> methods
+declared in <code>Point</code> and inherited in <code>ColorPoint</code>
+are represented by the identical <code>CtMethod</code> object.
+If the method definition represented by this
+<code>CtMethod</code> object is modified, the modification is
+reflected on both the methods.
+If you want to modify only the <code>move()</code> method in
+<code>ColorPoint</code>, you first have to add to <code>ColorPoint</code>
+a copy of the <code>CtMethod</code> object representing <code>move()</code>
+in <code>Point</code>. A copy of the the <code>CtMethod</code> object
+can be obtained by <code>CtNewMethod.copy()</code>.
+
+
<p><hr width="40%">
<ul>