View Javadoc

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