From 5ff19d5945cda4b3d554e79d726e8a19de9c5766 Mon Sep 17 00:00:00 2001 From: chiba Date: Tue, 8 Nov 2005 10:45:41 +0000 Subject: [PATCH] appended ClassPool(boolean) constructor. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@220 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/ClassPool.java | 15 +++++++++++++++ tutorial/tutorial.html | 20 ++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) 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 -- 2.39.5