001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.core; 018 019/** 020 * Interface to be implemented by a reloading-aware ClassLoader 021 * (e.g. a Groovy-based ClassLoader). Detected for example by 022 * Spring's CGLIB proxy factory for making a caching decision. 023 * 024 * <p>If a ClassLoader does <i>not</i> implement this interface, 025 * then all of the classes obtained from it should be considered 026 * as not reloadable (i.e. cacheable). 027 * 028 * @author Juergen Hoeller 029 * @since 2.5.1 030 */ 031public interface SmartClassLoader { 032 033 /** 034 * Determine whether the given class is reloadable (in this ClassLoader). 035 * <p>Typically used to check whether the result may be cached (for this 036 * ClassLoader) or whether it should be reobtained every time. 037 * @param clazz the class to check (usually loaded from this ClassLoader) 038 * @return whether the class should be expected to appear in a reloaded 039 * version (with a different {@code Class} object) later on 040 */ 041 boolean isClassReloadable(Class<?> clazz); 042 043}