1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.json.sample;
18
19 import org.apache.commons.lang.builder.EqualsBuilder;
20 import org.apache.commons.lang.builder.HashCodeBuilder;
21 import org.apache.commons.lang.builder.ToStringBuilder;
22 import org.apache.commons.lang.builder.ToStringStyle;
23
24
25
26
27 public class UnstandardBean {
28 private boolean bool = true;
29 private int id;
30 private int integer = 42;
31 private String string = "json";
32
33 public UnstandardBean( int id ) {
34 this.id = id;
35 }
36
37 public boolean equals( Object obj ) {
38 if( obj == this ){
39 return true;
40 }
41 if( obj == null ){
42 return false;
43 }
44 if( !UnstandardBean.class.isAssignableFrom( obj.getClass() ) ){
45 return false;
46 }
47 return EqualsBuilder.reflectionEquals( this, obj );
48 }
49
50 public int getId() {
51 return id;
52 }
53
54 public int getInteger() {
55 return integer;
56 }
57
58 public String getString() {
59 return string;
60 }
61
62 public int hashCode() {
63 return HashCodeBuilder.reflectionHashCode( this );
64 }
65
66 public boolean isBool() {
67 return bool;
68 }
69
70 public void setBool( boolean bool ) {
71 this.bool = bool;
72 }
73
74 public void setInteger( int integer ) {
75 this.integer = integer;
76 }
77
78 public void setString( String string ) {
79 this.string = string;
80 }
81
82 public String toString() {
83 return ToStringBuilder.reflectionToString( this, ToStringStyle.MULTI_LINE_STYLE );
84 }
85 }