KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > beans > Tree


1 package com.dotmarketing.beans;
2
3 import java.io.Serializable JavaDoc;
4
5 import org.apache.commons.lang.builder.EqualsBuilder;
6 import org.apache.commons.lang.builder.HashCodeBuilder;
7 import org.apache.commons.lang.builder.ToStringBuilder;
8
9 /**
10  *
11  * @author maria
12  */

13 public class Tree implements Serializable JavaDoc {
14
15     private static final long serialVersionUID = 1L;
16
17     /** identifier field */
18     private long parent;
19
20     /** identifier field */
21     private long child;
22
23     /** nullable persistent field */
24     private String JavaDoc relationType;
25
26     /** nullable persistent field */
27     private int treeOrder = 0;
28
29     /** full constructor */
30     public Tree(long parent, long child, java.lang.String JavaDoc relationType, int treeOrder) {
31         this.parent = parent;
32         this.child = child;
33         this.relationType = relationType;
34         this.treeOrder = treeOrder;
35     }
36
37     /** default constructor */
38     public Tree() {
39     }
40
41     /** minimal constructor */
42     public Tree(long parent, long child) {
43         this.parent = parent;
44         this.child = child;
45     }
46
47     public long getParent() {
48         return this.parent;
49     }
50
51     public void setParent(long parent) {
52         this.parent = parent;
53     }
54     public long getChild() {
55         return this.child;
56     }
57
58     public void setChild(long child) {
59         this.child = child;
60     }
61     public java.lang.String JavaDoc getRelationType() {
62         return this.relationType;
63     }
64
65     public void setRelationType(java.lang.String JavaDoc relationType) {
66         this.relationType = relationType;
67     }
68     public int getTreeOrder() {
69         return this.treeOrder;
70     }
71
72     public void setTreeOrder(int treeOrder) {
73         this.treeOrder = treeOrder;
74     }
75
76     public String JavaDoc toString() {
77         return ToStringBuilder.reflectionToString(this);
78     }
79
80     public boolean equals(Object JavaDoc other) {
81         if ( !(other instanceof Tree) ) return false;
82         Tree castOther = (Tree) other;
83         return new EqualsBuilder()
84             .append(this.parent, castOther.parent)
85             .append(this.child, castOther.child)
86             .append(this.relationType, castOther.relationType)
87             .isEquals();
88     }
89
90     public int hashCode() {
91         return new HashCodeBuilder()
92             .append(parent)
93             .append(child)
94             .append(this.relationType)
95             .toHashCode();
96     }
97 }
Popular Tags