01: /*
02: * JFox - The most lightweight Java EE Application Server!
03: * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
04: *
05: * JFox is licenced and re-distributable under GNU LGPL.
06: */
07: package org.jfox.ejb3;
08:
09: import java.io.Serializable;
10:
11: /**
12: * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
13: */
14: public class EJBObjectId implements Serializable {
15:
16: /**
17: * ejb name
18: */
19: private String ejbName;
20:
21: /**
22: * ejb instance id number
23: * empty if stateless ebj
24: */
25: private String ejbId = "";
26:
27: public EJBObjectId(String ejbName) {
28: this .ejbName = ejbName;
29: }
30:
31: public EJBObjectId(String ejbName, String ejbId) {
32: this .ejbName = ejbName;
33: this .ejbId = ejbId;
34: }
35:
36: public String getEJBName() {
37: return ejbName;
38: }
39:
40: public String getEJBId() {
41: return ejbId;
42: }
43:
44: public String toString() {
45: return getEJBName()
46: + (getEJBId().trim().length() == 0 ? "" : "@"
47: + getEJBId());
48: }
49:
50: public boolean equals(Object obj) {
51: if (obj == null || !(obj instanceof EJBObjectId)) {
52: return false;
53: }
54: return ((EJBObjectId) obj).ejbId.equals(ejbId)
55: && ((EJBObjectId) obj).ejbName.equals(ejbName);
56: }
57: }
|