Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » server » axis » client » [javadoc | source]
    1   /**
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     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    */
   17   package org.apache.openejb.server.axis.client;
   18   
   19   import net.sf.cglib.proxy.CallbackFilter;
   20   
   21   import java.lang.reflect.Method;
   22   import java.lang.reflect.Modifier;
   23   
   24   public class NoOverrideCallbackFilter implements CallbackFilter {
   25       private Class superClass;
   26   
   27       public NoOverrideCallbackFilter(Class superClass) {
   28           this.superClass = superClass;
   29       }
   30   
   31       public int accept(Method method) {
   32           // we don't intercept non-public methods like finalize
   33           if (!Modifier.isPublic(method.getModifiers())) {
   34               return 0;
   35           }
   36   
   37           if (method.getName().equals("remove") && Modifier.isAbstract(method.getModifiers())) {
   38               return 1;
   39           }
   40   
   41           try {
   42               // if the super class defined this method don't intercept
   43               superClass.getMethod(method.getName(), method.getParameterTypes());
   44               return 0;
   45           } catch (Throwable e) {
   46               return 1;
   47           }
   48       }
   49   
   50       public boolean equals(Object other) {
   51           if (other == null) {
   52               return false;
   53           }
   54           if (other == this) {
   55               return true;
   56           }
   57   
   58           NoOverrideCallbackFilter otherFilter = null;
   59           if (other instanceof NoOverrideCallbackFilter) {
   60               otherFilter = (NoOverrideCallbackFilter) other;
   61           } else {
   62               return false;
   63           }
   64   
   65           return superClass.equals(otherFilter.superClass);
   66       }
   67   
   68       public int hashCode() {
   69           return superClass.hashCode();
   70       }
   71   }

Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » server » axis » client » [javadoc | source]