001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.geronimo.j2ee.deployment;
018
019 import java.io.Serializable;
020
021 /**
022 * @version $Revision: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
023 */
024 public final class EJBRefInfo implements Serializable {
025 private final boolean isLocal;
026 private final boolean isSession;
027 private final String homeIntf;
028 private final String beanIntf;
029
030 public EJBRefInfo(boolean local, boolean session, String homeIntf, String beanIntf) {
031 assert homeIntf != null: "homeIntf is null";
032 assert beanIntf != null: "beanIntf is null";
033 isLocal = local;
034 isSession = session;
035 this.homeIntf = homeIntf;
036 this.beanIntf = beanIntf;
037 }
038
039 public boolean isLocal() {
040 return isLocal;
041 }
042
043 public boolean isSession() {
044 return isSession;
045 }
046
047 public String getHomeIntf() {
048 return homeIntf;
049 }
050
051 public String getBeanIntf() {
052 return beanIntf;
053 }
054
055 public boolean equals(Object object) {
056 if (!(object instanceof EJBRefInfo)) {
057 return false;
058 }
059
060 // match isSession
061 EJBRefInfo ejbRefInfo = (EJBRefInfo) object;
062 return ejbRefInfo.isLocal == isLocal &&
063 ejbRefInfo.isSession == isSession &&
064 ejbRefInfo.homeIntf.equals(homeIntf) &&
065 ejbRefInfo.beanIntf.equals(beanIntf);
066 }
067
068 public int hashCode() {
069 int result = 17;
070 result = 37 * result + (isLocal ? 1 : 0);
071 result = 37 * result + (isSession ? 1 : 0);
072 result = 37 * result + homeIntf.hashCode();
073 result = 37 * result + beanIntf.hashCode();
074 return result;
075 }
076 }