Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.j2ee.annotation » [javadoc | source]
    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements.  See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership.  The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with 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,
   13    * software distributed under the License is distributed on an
   14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   15    * KIND, either express or implied.  See the License for the
   16    * specific language governing permissions and limitations
   17    * under the License.
   18    */
   19   
   20   
   21   package org.apache.geronimo.j2ee.annotation;
   22   
   23   import java.io.Serializable;
   24   
   25   /**
   26    * @version $Rev: 568253 $ $Date: 2007-08-21 13:19:03 -0700 (Tue, 21 Aug 2007) $
   27    */
   28   public class Injection implements Serializable {
   29   
   30       private final String targetClassName;
   31       private final String targetName;
   32       private final String jndiName;
   33   
   34   
   35       public Injection(String targetClassName, String targetName, String jndiName) {
   36           this.targetClassName = targetClassName;
   37           this.targetName = targetName;
   38           this.jndiName = jndiName;
   39       }
   40   
   41   
   42       public String getTargetClassName() {
   43           return targetClassName;
   44       }
   45   
   46       public String getTargetName() {
   47           return targetName;
   48       }
   49   
   50       public String getJndiName() {
   51           return jndiName;
   52       }
   53       
   54       public String toString() {
   55           StringBuffer buf = new StringBuffer();
   56           buf.append(targetClassName).append(" ");
   57           buf.append(targetName).append(" ");
   58           buf.append(jndiName);
   59           return buf.toString();
   60       }
   61   
   62       public int hashCode() {
   63           final int prime = 31;
   64           int result = 1;
   65           result = prime * result + ((jndiName == null) ? 0 : jndiName.hashCode());
   66           result = prime * result + ((targetClassName == null) ? 0 : targetClassName.hashCode());
   67           result = prime * result + ((targetName == null) ? 0 : targetName.hashCode());
   68           return result;
   69       }
   70   
   71       public boolean equals(Object obj) {
   72           if (this == obj) {
   73               return true;
   74           }
   75           if (obj == null) {
   76               return false;
   77           }
   78           if (getClass() != obj.getClass()) {
   79               return false;
   80           }
   81           final Injection other = (Injection) obj;        
   82           if (jndiName == null) {
   83               if (other.jndiName != null) {
   84                   return false;
   85               }
   86           } else if (!jndiName.equals(other.jndiName)) {
   87               return false;
   88           }        
   89           if (targetClassName == null) {
   90               if (other.targetClassName != null) { 
   91                   return false;
   92               }
   93           } else if (!targetClassName.equals(other.targetClassName)) {
   94               return false;
   95           }        
   96           if (targetName == null) {
   97               if (other.targetName != null) {
   98                   return false;
   99               }
  100           } else if (!targetName.equals(other.targetName)) {
  101               return false;
  102           }
  103           
  104           return true;
  105       }
  106       
  107   }

Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.j2ee.annotation » [javadoc | source]