    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   */
    17
    18
    19  package org.apache.commons.beanutils;
    20
    21
    22
    23  /***
    24   * Specialist test bean for complex nested properties.
    25   *
    26   * @author Robert Burrell Donkin
    27   * @version $Revision: 469737 $ $Date: 2006-11-01 01:16:55 +0000 (Wed, 01 Nov 2006) $
    28   */
    29
    30  public class NestedTestBean {
    31
    32
    33      // ------------------------------------------------------------- Constructors
    34      public NestedTestBean(String name) {
    35          setName(name);
    36      }
    37
    38
    39      // ------------------------------------------------------------- Properties
    40
    41      private String name;
    42
    43      public String getName() {
    44          return name;
    45      }
    46
    47      public void setName(String name) {
    48          this.name = name;
    49      }
    50
    51
    52      private String testString = "NOT SET";
    53
    54      public String getTestString() {
    55          return testString;
    56      }
    57
    58      public void setTestString(String testString) {
    59          this.testString = testString;
    60      }
    61
    62
    63      private boolean testBoolean = false;
    64
    65      public boolean getTestBoolean() {
    66          return testBoolean;
    67      }
    68
    69      public void setTestBoolean(boolean testBoolean) {
    70          this.testBoolean = testBoolean;
    71      }
    72
    73
    74      private NestedTestBean indexedBeans[];
    75
    76      public void init() {
    77          indexedBeans = new NestedTestBean[5];
    78          indexedBeans[0] = new NestedTestBean("Bean@0");
    79          indexedBeans[1] = new NestedTestBean("Bean@1");
    80          indexedBeans[2] = new NestedTestBean("Bean@2");
    81          indexedBeans[3] = new NestedTestBean("Bean@3");
    82          indexedBeans[4] = new NestedTestBean("Bean@4");
    83
    84          simpleBean = new NestedTestBean("Simple Property Bean");
    85      }
    86
    87      public NestedTestBean getIndexedProperty(int index) {
    88          return (this.indexedBeans[index]);
    89      }
    90
    91      public void setIndexedProperty(int index, NestedTestBean value) {
    92          this.indexedBeans[index] = value;
    93      }
    94
    95      private NestedTestBean simpleBean;
    96
    97      public NestedTestBean getSimpleBeanProperty() {
    98          return simpleBean;
    99      }
    100
    101     // ------------------------------------------------------- Static Variables
    102
    103 }