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.extensions.compactnotation;
17  
18  public class Container {
19      private String title;
20      private String name;
21      private String id;
22  
23      public Container() {
24          this("no title");
25      }
26  
27      public Container(String title) {
28          this.title = title;
29      }
30  
31      @Override
32      public boolean equals(Object obj) {
33          if (obj instanceof Container) {
34              Container c = (Container) obj;
35              if (name != null && !name.equals(c.name)) {
36                  return false;
37              }
38              if (id != null && !id.equals(c.id)) {
39                  return false;
40              }
41              return title.equals(c.title);
42          } else {
43              return false;
44          }
45      }
46  
47      @Override
48      public int hashCode() {
49          return title.hashCode();
50      }
51  
52      @Override
53      public String toString() {
54          return "Container=" + title;
55      }
56  
57      public String getName() {
58          return name;
59      }
60  
61      public void setName(String name) {
62          this.name = name;
63      }
64  
65      public String getId() {
66          return id;
67      }
68  
69      public void setId(String id) {
70          this.id = id;
71      }
72  
73      public String getTitle() {
74          return title;
75      }
76  }