Home | History | Annotate | Download | only in javabeans
      1 /**
      2  * Copyright (c) 2008, 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.javabeans;
     17 
     18 public class Door {
     19     private String id;
     20     private int height;
     21 
     22     public Door(String id, int height) {
     23         this.id = id;
     24         this.height = height;
     25     }
     26 
     27     public Door() {
     28         this.height = 3;
     29     }
     30 
     31     public int getHeight() {
     32         return height;
     33     }
     34 
     35     public void setHeight(int height) {
     36         this.height = height;
     37     }
     38 
     39     @Override
     40     public boolean equals(Object obj) {
     41         if (obj instanceof Door) {
     42             Door door = (Door) obj;
     43             return id.equals(door.id);
     44         } else {
     45             return false;
     46         }
     47     }
     48 
     49     @Override
     50     public int hashCode() {
     51         return id.hashCode();
     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 String toString() {
     64         return "Door id=" + id;
     65     }
     66 
     67 }
     68