1 package org.argosfields.multi;
2
3 import java.io.Serializable;
4
5 import org.apache.commons.lang.NullArgumentException;
6 import org.apache.commons.lang.builder.HashCodeBuilder;
7 import org.apache.commons.lang.builder.ToStringBuilder;
8
9 /***
10 * Player.java
11 * @author Xavier Cho
12 * @version $Revision: 1.1 $ $Date: 2004/04/17 18:20:49 $
13 */
14 public class Player implements Serializable {
15 private String userName;
16
17 /***
18 * @param userName
19 */
20 public Player(final String userName) {
21 if (userName == null) {
22 throw new NullArgumentException("userName");
23 }
24
25 this.userName = userName;
26 }
27
28 /***
29 * @return Returns the userName.
30 */
31 public String getUserName() {
32 return userName;
33 }
34
35 /***
36 * @see java.lang.Object#equals(java.lang.Object)
37 */
38 public boolean equals(final Object obj) {
39 if (obj instanceof Player) {
40 Player player = (Player) obj;
41 return userName.equals(player.userName);
42 }
43
44 return false;
45 }
46
47 /***
48 * @see java.lang.Object#hashCode()
49 */
50 public int hashCode() {
51 HashCodeBuilder builder = new HashCodeBuilder();
52 builder.append(userName);
53
54 return builder.toHashCode();
55 }
56
57 /***
58 * @see java.lang.Object#toString()
59 */
60 public String toString() {
61 ToStringBuilder builder = new ToStringBuilder(this);
62 builder.append("userName", userName);
63
64 return builder.getStringBuffer().toString();
65 }
66 }
This page was automatically generated by Maven