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.client;
17:
18: import java.io.Serializable;
19:
20: /**
21: * @version $Rev: 607077 $ $Date: 2007-12-27 06:55:23 -0800 $
22: */
23: public class Injection implements Serializable {
24: private static final long serialVersionUID = 4009121701163822665L;
25: private final String targetClass;
26: private final String name;
27: private final String jndiName;
28:
29: public Injection(String targetClass, String name, String jndiName) {
30: if (targetClass == null)
31: throw new NullPointerException("targetClass is null");
32: if (name == null)
33: throw new NullPointerException("name is null");
34: if (jndiName == null)
35: throw new NullPointerException("jndiName is null");
36: this .targetClass = targetClass;
37: this .name = name;
38: this .jndiName = jndiName;
39: }
40:
41: public String getJndiName() {
42: return jndiName;
43: }
44:
45: public String getName() {
46: return name;
47: }
48:
49: public String getTargetClass() {
50: return targetClass;
51: }
52:
53: public boolean equals(Object o) {
54: if (this == o)
55: return true;
56: if (o == null || getClass() != o.getClass())
57: return false;
58:
59: Injection injection = (Injection) o;
60:
61: return name.equals(injection.name)
62: && targetClass.equals(injection.targetClass);
63: }
64:
65: public int hashCode() {
66: int result;
67: result = targetClass.hashCode();
68: result = 31 * result + name.hashCode();
69: return result;
70: }
71:
72: public String toString() {
73: return targetClass + "." + name + " -> " + jndiName;
74: }
75: }
|