View Javadoc

1   /*
2    * $Id: TestBean.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  package org.mule.module.json;
11  
12  import java.util.Arrays;
13  
14  /**
15   * Test bean for testing JSON
16   */
17  public class TestBean
18  {
19  
20      private String name;
21      private int id;
22      private double doublev;
23      private char[] options;
24      private String func1;
25  
26      public TestBean()
27      {
28          super();
29      }
30  
31      public TestBean(String name, int id, double doublev, String func1)
32      {
33          this.name = name;
34          this.id = id;
35          this.doublev = doublev;
36          this.func1 = func1;
37      }
38  
39      public double getDoublev()
40      {
41          return doublev;
42      }
43  
44      public void setDoublev(double doublev)
45      {
46          this.doublev = doublev;
47      }
48  
49      public String getFunc1()
50      {
51          return func1;
52      }
53  
54      public void setFunc1(String func1)
55      {
56          this.func1 = func1;
57      }
58  
59      public int getId()
60      {
61          return id;
62      }
63  
64      public void setId(int id)
65      {
66          this.id = id;
67      }
68  
69      public String getName()
70      {
71          return name;
72      }
73  
74      public void setName(String name)
75      {
76          this.name = name;
77      }
78  
79      public char[] getOptions()
80      {
81          return options;
82      }
83  
84      public void setOptions(char[] options)
85      {
86          this.options = options;
87      }
88  
89      @Override
90      public boolean equals(Object o)
91      {
92          if (this == o)
93          {
94              return true;
95          }
96          if (o == null || getClass() != o.getClass())
97          {
98              return false;
99          }
100 
101         TestBean testBean = (TestBean) o;
102 
103         if (id != testBean.id)
104         {
105             return false;
106         }
107         if (func1 != null ? !func1.equals(testBean.func1) : testBean.func1 != null)
108         {
109             return false;
110         }
111         if (name != null ? !name.equals(testBean.name) : testBean.name != null)
112         {
113             return false;
114         }
115 
116         return true;
117     }
118 
119     @Override
120     public int hashCode()
121     {
122         int result;
123         long temp;
124         result = name != null ? name.hashCode() : 0;
125         result = 31 * result + id;
126         temp = doublev != +0.0d ? Double.doubleToLongBits(doublev) : 0L;
127         result = 31 * result + (int) (temp ^ (temp >>> 32));
128         result = 31 * result + (options != null ? Arrays.hashCode(options) : 0);
129         result = 31 * result + (func1 != null ? func1.hashCode() : 0);
130         return result;
131     }
132 }