1 /* 2 * Copyright 2002-2007 the original author or authors. 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.springframework.aop.framework; 18 19 /** 20 * Strategy interface for a configured proxy, allowing for creation of proxy objects. 21 * 22 * <p>Out-of-the-box implementations are available for dynamic proxies and for CGLIB. 23 * 24 * @author Rod Johnson 25 * @author Juergen Hoeller 26 */ 27 public interface AopProxy { 28 29 /** 30 * Create a new proxy object. 31 * <p>Uses the AopProxy's default class loader (if necessary for proxy creation): 32 * usually, the thread context class loader. 33 * @see java.lang.Thread#getContextClassLoader() 34 */ 35 Object getProxy(); 36 37 /** 38 * Create a new proxy object. 39 * <p>Uses the given class loader (if necessary for proxy creation). 40 * <code>null</code> will simply be passed down and thus lead to the low-level 41 * proxy facility's default, which is usually different from the default chosen 42 * by the AopProxy implementation's {@link #getProxy()} method. 43 * @param classLoader the class loader to create the proxy with 44 * (or <code>null</code> for the low-level proxy facility's default) 45 */ 46 Object getProxy(ClassLoader classLoader); 47 48 } 49