View Javadoc

1   /**
2    * Copyright (c) 2008-2012, http://www.snakeyaml.org
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.yaml.snakeyaml.issues.issue29;
17  
18  import java.util.List;
19  import java.util.Map;
20  
21  public class BigJavaBean {
22      private String name;
23      private String address;
24      private String description;
25      private int id;
26      private List<Integer> numbers;
27      private Map<String, String> data;
28  
29      public BigJavaBean() {
30      }
31  
32      public BigJavaBean(int id, String name, String address, String description) {
33          super();
34          this.name = name;
35          this.address = address;
36          this.description = description;
37          this.id = id;
38      }
39  
40      public String getName() {
41          return name;
42      }
43  
44      public void setName(String name) {
45          this.name = name;
46      }
47  
48      public String getAddress() {
49          return address;
50      }
51  
52      public String getDescription() {
53          return description;
54      }
55  
56      public int getId() {
57          return id;
58      }
59  
60      public List<Integer> getNumbers() {
61          return numbers;
62      }
63  
64      public void setNumbers(List<Integer> numbers) {
65          this.numbers = numbers;
66      }
67  
68      public Map<String, String> getData() {
69          return data;
70      }
71  
72      public void setData(Map<String, String> data) {
73          this.data = data;
74      }
75  
76      @Override
77      public int hashCode() {
78          final int prime = 31;
79          int result = 1;
80          result = prime * result + ((address == null) ? 0 : address.hashCode());
81          result = prime * result + ((data == null) ? 0 : data.hashCode());
82          result = prime * result + ((description == null) ? 0 : description.hashCode());
83          result = prime * result + id;
84          result = prime * result + ((name == null) ? 0 : name.hashCode());
85          result = prime * result + ((numbers == null) ? 0 : numbers.hashCode());
86          return result;
87      }
88  
89      @Override
90      public boolean equals(Object obj) {
91          if (this == obj)
92              return true;
93          if (obj == null)
94              return false;
95          if (getClass() != obj.getClass())
96              return false;
97          BigJavaBean other = (BigJavaBean) obj;
98          if (address == null) {
99              if (other.address != null)
100                 return false;
101         } else if (!address.equals(other.address))
102             return false;
103         if (data == null) {
104             if (other.data != null)
105                 return false;
106         } else if (!data.equals(other.data))
107             return false;
108         if (description == null) {
109             if (other.description != null)
110                 return false;
111         } else if (!description.equals(other.description))
112             return false;
113         if (id != other.id)
114             return false;
115         if (name == null) {
116             if (other.name != null)
117                 return false;
118         } else if (!name.equals(other.name))
119             return false;
120         if (numbers == null) {
121             if (other.numbers != null)
122                 return false;
123         } else if (!numbers.equals(other.numbers))
124             return false;
125         return true;
126     }
127 }