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.jaxb.model;
8   
9   import javax.xml.bind.annotation.XmlAccessType;
10  import javax.xml.bind.annotation.XmlAccessorType;
11  import javax.xml.bind.annotation.XmlElement;
12  import javax.xml.bind.annotation.XmlRootElement;
13  
14  @XmlRootElement(name = "item")
15  @XmlAccessorType(XmlAccessType.FIELD)
16  public class Item
17  {
18      private String code;
19      private String description;
20  
21      @XmlElement(name = "in-stock")
22      private boolean inStock;
23  
24      public String getCode()
25      {
26          return code;
27      }
28  
29      public void setCode(String code)
30      {
31          this.code = code;
32      }
33  
34      public String getDescription()
35      {
36          return description;
37      }
38  
39      public void setDescription(String description)
40      {
41          this.description = description;
42      }
43  
44      public boolean isInStock()
45      {
46          return inStock;
47      }
48  
49      public void setInStock(boolean inStock)
50      {
51          this.inStock = inStock;
52      }
53  
54      @Override
55      public boolean equals(Object o)
56      {
57          if (this == o)
58          {
59              return true;
60          }
61          if (o == null || getClass() != o.getClass())
62          {
63              return false;
64          }
65  
66          Item item = (Item) o;
67  
68          if (inStock != item.inStock)
69          {
70              return false;
71          }
72          if (code != null ? !code.equals(item.code) : item.code != null)
73          {
74              return false;
75          }
76          if (description != null ? !description.equals(item.description) : item.description != null)
77          {
78              return false;
79          }
80  
81          return true;
82      }
83  
84      @Override
85      public int hashCode()
86      {
87          int result = code != null ? code.hashCode() : 0;
88          result = 31 * result + (description != null ? description.hashCode() : 0);
89          result = 31 * result + (inStock ? 1 : 0);
90          return result;
91      }
92  }