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