01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.server.axis.client;
17:
18: import net.sf.cglib.proxy.CallbackFilter;
19:
20: import java.lang.reflect.Method;
21: import java.lang.reflect.Modifier;
22:
23: public class NoOverrideCallbackFilter implements CallbackFilter {
24: private Class super Class;
25:
26: public NoOverrideCallbackFilter(Class super Class) {
27: this .super Class = super Class;
28: }
29:
30: public int accept(Method method) {
31: // we don't intercept non-public methods like finalize
32: if (!Modifier.isPublic(method.getModifiers())) {
33: return 0;
34: }
35:
36: if (method.getName().equals("remove")
37: && Modifier.isAbstract(method.getModifiers())) {
38: return 1;
39: }
40:
41: try {
42: // if the super class defined this method don't intercept
43: super Class.getMethod(method.getName(), method
44: .getParameterTypes());
45: return 0;
46: } catch (Throwable e) {
47: return 1;
48: }
49: }
50:
51: public boolean equals(Object other) {
52: if (other == null) {
53: return false;
54: }
55: if (other == this ) {
56: return true;
57: }
58:
59: NoOverrideCallbackFilter otherFilter = null;
60: if (other instanceof NoOverrideCallbackFilter) {
61: otherFilter = (NoOverrideCallbackFilter) other;
62: } else {
63: return false;
64: }
65:
66: return super Class.equals(otherFilter.super Class);
67: }
68:
69: public int hashCode() {
70: return superClass.hashCode();
71: }
72: }
|