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 java.util.List;
10  
11  import javax.xml.bind.annotation.XmlAccessType;
12  import javax.xml.bind.annotation.XmlAccessorType;
13  import javax.xml.bind.annotation.XmlElement;
14  import javax.xml.bind.annotation.XmlElementWrapper;
15  import javax.xml.bind.annotation.XmlRootElement;
16  
17  /**
18   * A Person object
19   */
20  @XmlRootElement(name = "person")
21  @XmlAccessorType(XmlAccessType.FIELD)
22  public class Person
23  {
24      private String name;
25      private String dob;
26  
27      @XmlElementWrapper(name = "emailAddresses")
28      @XmlElement(name = "emailAddress")
29      private List<EmailAddress> emailAddresses;
30  
31      public String getName()
32      {
33          return name;
34      }
35  
36      public void setName(String name)
37      {
38          this.name = name;
39      }
40  
41      public String getDob()
42      {
43          return dob;
44      }
45  
46      public void setDob(String dob)
47      {
48          this.dob = dob;
49      }
50  
51      public List<EmailAddress> getEmailAddresses()
52      {
53          return emailAddresses;
54      }
55  
56      public void setEmailAddresses(List<EmailAddress> emailAddresses)
57      {
58          this.emailAddresses = emailAddresses;
59      }
60  
61      @Override
62      public boolean equals(Object o)
63      {
64          if (this == o)
65          {
66              return true;
67          }
68          if (o == null || getClass() != o.getClass())
69          {
70              return false;
71          }
72  
73          Person person = (Person) o;
74  
75          if (dob != null ? !dob.equals(person.dob) : person.dob != null)
76          {
77              return false;
78          }
79          if (emailAddresses != null ? !emailAddresses.equals(person.emailAddresses) : person.emailAddresses != null)
80          {
81              return false;
82          }
83          if (name != null ? !name.equals(person.name) : person.name != null)
84          {
85              return false;
86          }
87  
88          return true;
89      }
90  
91      @Override
92      public int hashCode()
93      {
94          int result = name != null ? name.hashCode() : 0;
95          result = 31 * result + (dob != null ? dob.hashCode() : 0);
96          result = 31 * result + (emailAddresses != null ? emailAddresses.hashCode() : 0);
97          return result;
98      }
99  }