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