/Users/lyon/j4p/src/javassist/ClassPath.java
|
1 /*
2 * Javassist, a Java-bytecode translator toolkit.
3 * Copyright (C) 1999-2003 Shigeru Chiba. All Rights Reserved.
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. Alternatively, the contents of this file may be used under
8 * the terms of the GNU Lesser General Public License Version 2.1 or later.
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 */
15
16 package javassist;
17
18 import java.io.InputStream;
19
20 /**
21 * <code>ClassPath</code> is an interface implemented by objects
22 * representing a class search path.
23 * <code>ClassPool</code> uses those objects for reading class files.
24 *
25 * <code>The users can define a class implementing this interface so that
26 * a class file is obtained from a non-standard source.
27 *
28 * @see ClassPool#insertClassPath(ClassPath)
29 * @see ClassPool#appendClassPath(ClassPath)
30 * @see ClassPool#removeClassPath(ClassPath)
31 */
32 public interface ClassPath {
33 /**
34 * Opens a class file.
35 * This method may be called just to examine whether the class file
36 * exists as well as to read the contents of the file.
37 *
38 * <p>This method can return null if the specified class file is not
39 * found. If null is returned, the next search path is examined.
40 * However, if an error happens, this method must throw an exception
41 * so that the search is terminated.
42 *
43 * <p>This method should not modify the contents of the class file.
44 * Use <code>javassist.Translator</code> for modification.
45 *
46 * @param classname a fully-qualified class name
47 * @return the input stream for reading a class file
48 * @see javassist.Translator
49 */
50 InputStream openClassfile(String classname) throws NotFoundException;
51
52 /**
53 * This method is invoked when the <code>ClassPath</code> object is
54 * detached from the search path. It will be an empty method in most of
55 * classes.
56 */
57 void close();
58 }
59