View Javadoc

1   /*
2    * Copyright  2000-2004 The Apache Software Foundation
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License"); 
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License. 
15   *
16   */
17  package org.apache.bcel.util;
18  
19  import org.apache.bcel.classfile.JavaClass;
20  
21  /***
22   * Abstract definition of a class repository. Instances may be used
23   * to load classes from different sources and may be used in the
24   * Repository.setRepository method.
25   *
26   * @see org.apache.bcel.Repository
27   * @version $Id: Repository.java 386056 2006-03-15 11:31:56Z tcurdt $
28   * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
29   * @author David Dixon-Peugh
30   */
31  public interface Repository extends java.io.Serializable {
32  
33      /***
34       * Store the provided class under "clazz.getClassName()" 
35       */
36      public void storeClass( JavaClass clazz );
37  
38  
39      /***
40       * Remove class from repository
41       */
42      public void removeClass( JavaClass clazz );
43  
44  
45      /***
46       * Find the class with the name provided, if the class
47       * isn't there, return NULL.
48       */
49      public JavaClass findClass( String className );
50  
51  
52      /***
53       * Find the class with the name provided, if the class
54       * isn't there, make an attempt to load it.
55       */
56      public JavaClass loadClass( String className ) throws java.lang.ClassNotFoundException;
57  
58  
59      /***
60       * Find the JavaClass instance for the given run-time class object
61       */
62      public JavaClass loadClass( Class clazz ) throws java.lang.ClassNotFoundException;
63  
64  
65      /*** Clear all entries from cache.
66       */
67      public void clear();
68  
69  
70      /*** Get the ClassPath associated with this Repository
71       */
72      public ClassPath getClassPath();
73  }