From: chiba Date: Tue, 8 Nov 2005 10:45:41 +0000 (+0000) Subject: appended ClassPool(boolean) constructor. X-Git-Tag: rel_3_17_1_ga~406 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5ff19d5945cda4b3d554e79d726e8a19de9c5766;p=javassist.git appended ClassPool(boolean) constructor. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@220 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java index bb90da88..35b92f93 100644 --- a/src/main/javassist/ClassPool.java +++ b/src/main/javassist/ClassPool.java @@ -122,6 +122,21 @@ public class ClassPool { this(null); } + /** + * Creates a root class pool. If useDefaultPath is + * true, appendSystemPath() 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. * diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html index 9644016a..f3766d43 100644 --- a/tutorial/tutorial.html +++ b/tutorial/tutorial.html @@ -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. -

The class Javassist.CtClass is an abstract +

The class Javassist.CtClass is an absatract representation of a class file. A CtClass (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 ClassPool, execute the following code snippet:

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

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

-

Cascaded ClassPools.

+

Cascaded ClassPools

If a program is running on a web application server, @@ -460,8 +469,7 @@ transformation. snippet (this code was already shown above):

If you have two ClassPool objects, then you can