1   /*
2    * Copyright 2006-2007-2007 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package net.sf.ezmorph.bean.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   * @author Andres Almiray <aalmiray@users.sourceforge.net>
26   */
27  public class BeanD
28  {
29     private boolean bool = true;
30     private double decimal = 0d;
31     private int integer = 42;
32  
33     public boolean equals( Object obj )
34     {
35        if( obj == this ){
36           return true;
37        }
38        if( obj == null ){
39           return false;
40        }
41        if( !BeanD.class.isAssignableFrom( obj.getClass() ) ){
42           return false;
43        }
44        return EqualsBuilder.reflectionEquals( this, obj );
45     }
46  
47     public double getDecimal()
48     {
49        return decimal;
50     }
51  
52     public int getInteger()
53     {
54        return integer;
55     }
56  
57     public int hashCode()
58     {
59        return HashCodeBuilder.reflectionHashCode( this );
60     }
61  
62     public boolean isBool()
63     {
64        return bool;
65     }
66  
67     public void setBool( boolean bool )
68     {
69        this.bool = bool;
70     }
71  
72     public void setDecimal( double decimal )
73     {
74        this.decimal = decimal;
75     }
76  
77     public void setInteger( int integer )
78     {
79        this.integer = integer;
80     }
81  
82     public String toString()
83     {
84        return ToStringBuilder.reflectionToString( this, ToStringStyle.MULTI_LINE_STYLE );
85     }
86  }