01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jboss.test.hibernate.timers;
23:
24: import java.io.Serializable;
25:
26: /**
27: The Timers table key
28:
29: @author Scott.Stark@jboss.org
30: @version $Revision: 57211 $
31: */
32: public class TimersID implements Serializable {
33: private static final long serialVersionUID = 1L;
34:
35: private String timerID;
36: private String targetID;
37:
38: public TimersID() {
39: }
40:
41: public TimersID(String timerID, String targetID) {
42: this .timerID = timerID;
43: this .targetID = targetID;
44: }
45:
46: public String getTimerID() {
47: return this .timerID;
48: }
49:
50: public void setTimerID(String timerID) {
51: this .timerID = timerID;
52: }
53:
54: public String getTargetID() {
55: return this .targetID;
56: }
57:
58: public void setTargetID(String targetID) {
59: this .targetID = targetID;
60: }
61:
62: public boolean equals(Object other) {
63: if ((this == other))
64: return true;
65: if ((other == null))
66: return false;
67: if (!(other instanceof TimersID))
68: return false;
69: TimersID castOther = (TimersID) other;
70:
71: return ((this .getTimerID() == castOther.getTimerID()) || (this
72: .getTimerID() != null
73: && castOther.getTimerID() != null && this .getTimerID()
74: .equals(castOther.getTimerID())))
75: && ((this .getTargetID() == castOther.getTargetID()) || (this
76: .getTargetID() != null
77: && castOther.getTargetID() != null && this
78: .getTargetID().equals(castOther.getTargetID())));
79: }
80:
81: public int hashCode() {
82: int result = 17;
83:
84: result = 37
85: * result
86: + (getTimerID() == null ? 0 : this .getTimerID()
87: .hashCode());
88: result = 37
89: * result
90: + (getTargetID() == null ? 0 : this.getTargetID()
91: .hashCode());
92: return result;
93: }
94:
95: }
|