View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.tck.testmodels.fruit;
8   
9   /**
10   * A pure bean implementation
11   */
12  public class GrapeFruit implements Fruit
13  {
14      private Integer segments = new Integer(10);
15      private Double radius = new Double(4.34);
16      private String brand = "Pirulo";
17      private boolean red = false;
18      private boolean bitten = false;
19  
20      public GrapeFruit()
21      {
22          super();
23      }
24  
25      public GrapeFruit(Integer segments, Double radius, String brand, boolean red)
26      {
27          this.segments = segments;
28          this.radius = radius;
29          this.brand = brand;
30          this.red = red;
31      }
32  
33      public String getBrand()
34      {
35          return brand;
36      }
37  
38      public Integer getSegments()
39      {
40          return segments;
41      }
42  
43      public Double getRadius()
44      {
45          return radius;
46      }
47  
48      public void setBrand(String string)
49      {
50          brand = string;
51      }
52  
53      public void setSegments(Integer integer)
54      {
55          segments = integer;
56      }
57  
58      public void setRadius(Double double1)
59      {
60          radius = double1;
61      }
62  
63      public boolean isRed()
64      {
65          return red;
66      }
67  
68      public void setRed(boolean red)
69      {
70          this.red = red;
71      }
72  
73      public void bite()
74      {
75          bitten = true;
76      }
77  
78      public boolean isBitten()
79      {
80          return bitten;
81      }
82  
83      @Override
84      public boolean equals(Object o)
85      {
86          if (this == o)
87          {
88              return true;
89          }
90          if (!(o instanceof GrapeFruit))
91          {
92              return false;
93          }
94  
95          GrapeFruit that = (GrapeFruit) o;
96  
97          if (red != that.red)
98          {
99              return false;
100         }
101         if (brand != null ? !brand.equals(that.brand) : that.brand != null)
102         {
103             return false;
104         }
105         if (radius != null ? !radius.equals(that.radius) : that.radius != null)
106         {
107             return false;
108         }
109         if (segments != null ? !segments.equals(that.segments) : that.segments != null)
110         {
111             return false;
112         }
113 
114         return true;
115     }
116 
117     @Override
118     public int hashCode()
119     {
120         int result = segments != null ? segments.hashCode() : 0;
121         result = 31 * result + (radius != null ? radius.hashCode() : 0);
122         result = 31 * result + (brand != null ? brand.hashCode() : 0);
123         result = 31 * result + (red ? 1 : 0);
124         result = 31 * result + (bitten ? 1 : 0);
125         return result;
126     }
127 }