View Javadoc

1   /**
2    * Copyright (c) 2008-2011, 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  
17  package org.yaml.snakeyaml.emitter.template;
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import org.yaml.snakeyaml.immutable.Point;
23  
24  public class MyBean {
25      private Point point;
26      private List<String> list;
27      private List<Integer> empty = new ArrayList<Integer>();
28      private String id;
29  
30      public Point getPoint() {
31          return point;
32      }
33  
34      public void setPoint(Point point) {
35          this.point = point;
36      }
37  
38      public List<String> getList() {
39          return list;
40      }
41  
42      public void setList(List<String> list) {
43          this.list = list;
44      }
45  
46      public List<Integer> getEmpty() {
47          return empty;
48      }
49  
50      public void setEmpty(List<Integer> empty) {
51          this.empty = empty;
52      }
53  
54      public String getId() {
55          return id;
56      }
57  
58      public void setId(String id) {
59          this.id = id;
60      }
61  
62      @Override
63      public boolean equals(Object obj) {
64          if (obj instanceof MyBean) {
65              MyBean bean = (MyBean) obj;
66              if (!id.equals(bean.id)) {
67                  return false;
68              }
69              if (!point.equals(bean.point)) {
70                  return false;
71              }
72              if (!list.equals(bean.list)) {
73                  return false;
74              }
75              if (!empty.equals(bean.empty)) {
76                  return false;
77              }
78              return true;
79          } else {
80              return false;
81          }
82      }
83  
84      @Override
85      public int hashCode() {
86          return id.hashCode();
87      }
88  
89      @Override
90      public String toString() {
91          return id;
92      }
93  
94  }