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