Browse Source

appended ClassPool(boolean) constructor.


git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@220 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
tags/rel_3_17_1_ga
chiba 18 years ago
parent
commit
5ff19d5945
2 changed files with 29 additions and 6 deletions
  1. 15
    0
      src/main/javassist/ClassPool.java
  2. 14
    6
      tutorial/tutorial.html

+ 15
- 0
src/main/javassist/ClassPool.java View File

@@ -122,6 +122,21 @@ public class ClassPool {
this(null);
}

/**
* Creates a root class pool. If <code>useDefaultPath</code> is
* true, <code>appendSystemPath()</code> is called. Otherwise,
* this constructor is equivalent to the constructor taking no
* parameter.
*
* @param useDefaultPath true if the system search path is
* appended.
*/
public ClassPool(boolean useDefaultPath) {
this(null);
if (useDefaultPath)
appendSystemPath();
}

/**
* Creates a class pool.
*

+ 14
- 6
tutorial/tutorial.html View File

@@ -35,7 +35,7 @@ Shigeru Chiba
Java bytecode is stored in a binary file called a class file.
Each class file contains one Java class or interface.

<p>The class <code>Javassist.CtClass</code> is an abstract
<p>The class <code>Javassist.CtClass</code> is an absatract
representation of a class file. A <code>CtClass</code> (compile-time
class) object is a handle for dealing with a class file. The
following program is a very simple example:
@@ -338,8 +338,8 @@ To create a new instance of <code>ClassPool</code>, execute the following
code snippet:

<ul><pre>
ClassPool cp = new ClassPool();
cp.appendSystemPath(); // or append another path by appendClassPath()
ClassPool cp = new ClassPool(true);
// if needed, append an extra search path by appendClassPath()
</pre></ul>

<p>This creates a <code>ClassPool</code> object that behaves as the
@@ -353,8 +353,17 @@ A <code>ClassPool</code> object returned by <code>getDefault()</code>
does not have a special role. <code>getDefault()</code> is a convenience
method.

<p>Note that <code>new ClassPool(true)</code> is a convenient constructor,
which constructs a <code>ClassPool</code> object and appends the system
search path to it. Calling that constructor is
equivalent to the following code:

<ul><pre>
ClassPool cp = new ClassPool();
cp.appendSystemPath(); // or append another path by appendClassPath()
</pre></ul>

<h4>Cascaded ClassPools.</h4>
<h4>Cascaded ClassPools</h4>

<p>
<em>If a program is running on a web application server,</em>
@@ -460,8 +469,7 @@ transformation.
snippet (this code was already <a href="#avoidmemory">shown above</a>):

<ul><pre>
ClassPool cp = new ClassPool();
cp.appendSystemPath(); // or append another path by appendClassPath()
ClassPool cp = new ClassPool(true);
</pre></ul>

<p>If you have two <code>ClassPool</code> objects, then you can

Loading…
Cancel
Save