01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tcspring;
05:
06: public class ComplexBeanId {
07: private String scopeId = null;
08: private String beanName = null;
09:
10: public ComplexBeanId(String beanName) {
11: this ("singleton", beanName);
12: }
13:
14: public ComplexBeanId(String newScopeId, String newBeanName) {
15: this .scopeId = newScopeId;
16: this .beanName = newBeanName;
17: }
18:
19: public String getBeanName() {
20: return beanName;
21: }
22:
23: public String getScopeId() {
24: return scopeId;
25: }
26:
27: public int hashCode() {
28: return (31 * scopeId.hashCode()) + beanName.hashCode();
29: }
30:
31: public boolean equals(Object obj) {
32: if (this == obj)
33: return true;
34: if (obj == null)
35: return false;
36: if (getClass() != obj.getClass())
37: return false;
38:
39: ComplexBeanId other = (ComplexBeanId) obj;
40: if (beanName == null) {
41: if (other.beanName != null) {
42: return false;
43: }
44: } else if (!beanName.equals(other.beanName)) {
45: return false;
46: }
47:
48: if (scopeId == null) {
49: if (other.scopeId != null) {
50: return false;
51: }
52: } else if (!scopeId.equals(other.scopeId)) {
53: return false;
54: }
55:
56: return true;
57: }
58:
59: public String toString() {
60: return scopeId + ":" + beanName;
61: }
62:
63: }
|