01: /*
02: * Copyright 2003,2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package net.sf.cglib.proxy;
17:
18: import java.lang.reflect.Method;
19:
20: /**
21: * Map methods of subclasses generated by {@link Enhancer} to a particular
22: * callback. The type of the callbacks chosen for each method affects
23: * the bytecode generated for that method in the subclass, and cannot
24: * change for the life of the class.
25: */
26: public interface CallbackFilter {
27: /**
28: * Map a method to a callback.
29: * @param method the intercepted method
30: * @return the index into the array of callbacks (as specified by {@link Enhancer#setCallbacks}) to use for the method,
31: */
32: int accept(Method method);
33:
34: /**
35: * The <code>CallbackFilter</code> in use affects which cached class
36: * the <code>Enhancer</code> will use, so this is a reminder that
37: * you should correctly implement <code>equals</code> and
38: * <code>hashCode</code> for custom <code>CallbackFilter</code>
39: * implementations in order to improve performance.
40: */
41: boolean equals(Object o);
42: }
|