KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > xml > book > BookCharacter


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.test.xml.book;
8
9 /**
10  * BookCharacter class that represents the character element in XML content.
11  *
12  * @version <tt>$Revision: 1.1 $</tt>
13  * @author <a HREF="mailto:alex@jboss.org">Alexey Loubyansky</a>
14  */

15 public class BookCharacter
16 {
17    private String JavaDoc name;
18    private String JavaDoc friendOf;
19    private String JavaDoc since;
20    private String JavaDoc qualification;
21
22    public String JavaDoc getName()
23    {
24       return name;
25    }
26
27    public void setName(String JavaDoc name)
28    {
29       this.name = name;
30    }
31
32    public String JavaDoc getFriendOf()
33    {
34       return friendOf;
35    }
36
37    public void setFriendOf(String JavaDoc friendOf)
38    {
39       this.friendOf = friendOf;
40    }
41
42    public String JavaDoc getSince()
43    {
44       return since;
45    }
46
47    public void setSince(String JavaDoc since)
48    {
49       this.since = since;
50    }
51
52    public String JavaDoc getQualification()
53    {
54       return qualification;
55    }
56
57    public void setQualification(String JavaDoc qualification)
58    {
59       this.qualification = qualification;
60    }
61
62    public boolean equals(Object JavaDoc o)
63    {
64       if(this == o) return true;
65       if(!(o instanceof BookCharacter)) return false;
66
67       final BookCharacter bookCharacter = (BookCharacter)o;
68
69       if(friendOf != null ? !friendOf.equals(bookCharacter.friendOf) : bookCharacter.friendOf != null) return false;
70       if(name != null ? !name.equals(bookCharacter.name) : bookCharacter.name != null) return false;
71       if(qualification != null ? !qualification.equals(bookCharacter.qualification) : bookCharacter.qualification != null) return false;
72       if(since != null ? !since.equals(bookCharacter.since) : bookCharacter.since != null) return false;
73
74       return true;
75    }
76
77    public int hashCode()
78    {
79       int result;
80       result = (name != null ? name.hashCode() : 0);
81       result = 29 * result + (friendOf != null ? friendOf.hashCode() : 0);
82       result = 29 * result + (since != null ? since.hashCode() : 0);
83       result = 29 * result + (qualification != null ? qualification.hashCode() : 0);
84       return result;
85    }
86
87    public String JavaDoc toString()
88    {
89       StringBuffer JavaDoc sb = new StringBuffer JavaDoc(50);
90       sb.append('[')
91          .append("name=").append(name)
92          .append(", friend-of=").append(friendOf)
93          .append(", since=").append(since)
94          .append(", qualification=").append(qualification)
95          .append(']');
96       return sb.toString();
97    }
98 }
99
Popular Tags