Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » core » interceptor » [javadoc | source]
    1   /**
    2    *
    3    * Licensed to the Apache Software Foundation (ASF) under one or more
    4    * contributor license agreements.  See the NOTICE file distributed with
    5    * this work for additional information regarding copyright ownership.
    6    * The ASF licenses this file to You under the Apache License, Version 2.0
    7    * (the "License"); you may not use this file except in compliance with
    8    * the License.  You may obtain a copy of the License at
    9    *
   10    *     http://www.apache.org/licenses/LICENSE-2.0
   11    *
   12    *  Unless required by applicable law or agreed to in writing, software
   13    *  distributed under the License is distributed on an "AS IS" BASIS,
   14    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15    *  See the License for the specific language governing permissions and
   16    *  limitations under the License.
   17    */
   18   package org.apache.openejb.core.interceptor;
   19   
   20   import org.apache.openejb.core.Operation;
   21   
   22   import java.lang.reflect.Method;
   23   import java.util.ArrayList;
   24   import java.util.List;
   25   import java.util.Collections;
   26   
   27   /**
   28    * @version $Rev: 538389 $ $Date: 2007-05-15 16:47:50 -0700 (Tue, 15 May 2007) $
   29    */
   30   public class InterceptorData {
   31   
   32       private Class clazz;
   33   
   34       private final List<Method> aroundInvoke = new ArrayList<Method>();
   35   
   36       private final List<Method> postConstruct = new ArrayList<Method>();
   37       private final List<Method> preDestroy = new ArrayList<Method>();
   38   
   39       private final List<Method> postActivate = new ArrayList<Method>();
   40       private final List<Method> prePassivate = new ArrayList<Method>();
   41   
   42       public InterceptorData(Class clazz) {
   43           this.clazz = clazz;
   44       }
   45   
   46       public Class getInterceptorClass() {
   47           return clazz;
   48       }
   49   
   50       public List<Method> getAroundInvoke() {
   51           return aroundInvoke;
   52       }
   53   
   54       public List<Method> getPostConstruct() {
   55           return postConstruct;
   56       }
   57   
   58       public List<Method> getPreDestroy() {
   59           return preDestroy;
   60       }
   61   
   62       public List<Method> getPostActivate() {
   63           return postActivate;
   64       }
   65   
   66       public List<Method> getPrePassivate() {
   67           return prePassivate;
   68       }
   69   
   70       public List<Method> getMethods(Operation operation) {
   71           switch(operation) {
   72               case BUSINESS: return getAroundInvoke();
   73               case BUSINESS_WS: return getAroundInvoke();
   74               case REMOVE: return getAroundInvoke();
   75               case POST_CONSTRUCT: return getPostConstruct();
   76               case PRE_DESTROY: return getPreDestroy();
   77               case ACTIVATE: return getPostActivate();
   78               case PASSIVATE: return getPrePassivate();
   79               case AFTER_BEGIN: return getAroundInvoke();
   80               case AFTER_COMPLETION: return getAroundInvoke();
   81               case BEFORE_COMPLETION: return getAroundInvoke();
   82           }
   83           return Collections.EMPTY_LIST;
   84       }
   85   
   86       public boolean equals(Object o) {
   87           if (this == o) return true;
   88           if (o == null || getClass() != o.getClass()) return false;
   89   
   90           final InterceptorData that = (InterceptorData) o;
   91   
   92           if (clazz != null ? !clazz.equals(that.clazz) : that.clazz != null) return false;
   93   
   94           return true;
   95       }
   96   
   97       public int hashCode() {
   98           return (clazz != null ? clazz.hashCode() : 0);
   99       }
  100   }

Save This Page
Home » openejb-3.1.2-src » org.apache » openejb » core » interceptor » [javadoc | source]