View Javadoc

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