View Javadoc

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