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 examples.staticstate;
    18
    19  public class Wrapper {
    20      private String name;
    21      private int age;
    22      private String color;
    23      private String type;
    24
    25      public JavaBeanWithStaticState createBean() {
    26          JavaBeanWithStaticState bean = new JavaBeanWithStaticState();
    27          bean.setAge(age);
    28          bean.setName(name);
    29          JavaBeanWithStaticState.color = color;
    30          JavaBeanWithStaticState.setType(type);
    31          return bean;
    32      }
    33
    34      public Wrapper() {
    35          color = JavaBeanWithStaticState.color;
    36          type = JavaBeanWithStaticState.getType();
    37      }
    38
    39      public Wrapper(JavaBeanWithStaticState bean) {
    40          this();
    41          name = bean.getName();
    42          age = bean.getAge();
    43      }
    44
    45      public String getName() {
    46          return name;
    47      }
    48
    49      public void setName(String name) {
    50          this.name = name;
    51      }
    52
    53      public int getAge() {
    54          return age;
    55      }
    56
    57      public void setAge(int age) {
    58          this.age = age;
    59      }
    60
    61      public String getColor() {
    62          return color;
    63      }
    64
    65      public void setColor(String color) {
    66          this.color = color;
    67      }
    68
    69      public String getType() {
    70          return type;
    71      }
    72
    73      public void setType(String type) {
    74          this.type = type;
    75      }
    76  }