01: ///////////////////////////////////////////////////////////////////////////////
02: //
03: // Copyright (C) 2003-@year@ by Thomas M. Hazel, MyOODB (www.myoodb.org)
04: //
05: // All Rights Reserved
06: //
07: // This program is free software; you can redistribute it and/or modify
08: // it under the terms of the GNU General Public License and GNU Library
09: // General Public License as published by the Free Software Foundation;
10: // either version 2, or (at your option) any later version.
11: //
12: // This program 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
15: // GNU General Public License and GNU Library General Public License
16: // for more details.
17: //
18: // You should have received a copy of the GNU General Public License
19: // and GNU Library General Public License along with this program; if
20: // not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
21: // MA 02139, USA.
22: //
23: ///////////////////////////////////////////////////////////////////////////////
24: package org.myoodb.core;
25:
26: import java.io.*;
27:
28: public final class User implements Externalizable {
29: private String m_name;
30: private String m_password;
31:
32: public User() {
33: }
34:
35: public User(String name, String password) {
36: m_name = name;
37: m_password = password;
38: }
39:
40: public String getName() {
41: return m_name;
42: }
43:
44: public String getPassword() {
45: return m_password;
46: }
47:
48: public void setPassword(String password) {
49: m_password = password;
50: }
51:
52: public int hashCode() {
53: return m_name.hashCode();
54: }
55:
56: public boolean equals(Object obj) {
57: if (this == obj) {
58: return true;
59: } else if (obj instanceof User) {
60: return m_name.equals(((User) obj).m_name);
61: } else {
62: return false;
63: }
64: }
65:
66: public String toString() {
67: return m_name;
68: }
69:
70: public void writeExternal(ObjectOutput out) throws IOException {
71: out.writeObject(m_name);
72: out.writeObject(m_password);
73: }
74:
75: public void readExternal(ObjectInput in) throws IOException,
76: ClassNotFoundException {
77: m_name = (String) in.readObject();
78: m_password = (String) in.readObject();
79: }
80: }
|