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