View Javadoc
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    *      https://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  package org.apache.commons.beanutils2;
19  
20  import java.util.ArrayList;
21  import java.util.List;
22  
23  /**
24   * Indexed Properties Test bean for JUnit tests for the "beanutils" component.
25   */
26  public class IndexedTestBean {
27  
28      private String[] stringArray;
29      private List<String> stringList;
30      private ArrayList<Object> arrayList;
31  
32      /**
33       * Constructs a new instance.
34       */
35      public IndexedTestBean() {
36      }
37  
38      /**
39       * Getter for the java.util.ArrayList property.
40       */
41      public ArrayList<Object> getArrayList() {
42          return arrayList;
43      }
44  
45      /**
46       * Indexed Getter for the java.util.ArrayList property.
47       */
48      public Object getArrayList(final int index) {
49          return arrayList.get(index);
50      }
51  
52      /**
53       * Getter for the String[] property.
54       */
55      public String[] getStringArray() {
56          return stringArray;
57      }
58  
59      /**
60       * Indexed Getter for the String[] property.
61       */
62      public String getStringArray(final int index) {
63          return stringArray[index];
64      }
65  
66      /**
67       * Getter for the java.util.List property.
68       */
69      public List<String> getStringList() {
70          return stringList;
71      }
72  
73      /**
74       * Indexed Getter for the java.util.List property.
75       */
76      public String getStringList(final int index) {
77          return stringList.get(index);
78      }
79  
80      /**
81       * Setter for the java.util.ArrayList property.
82       */
83      public void setArrayList(final ArrayList<Object> arrayList) {
84          this.arrayList = arrayList;
85      }
86  
87      /**
88       * Indexed Setter for the java.util.ArrayList property.
89       */
90      public void setArrayList(final int index, final Object value) {
91          arrayList.add(index, value);
92      }
93  
94      /**
95       * Indexed Setter for the String[] property.
96       */
97      public void setStringArray(final int index, final String value) {
98          stringArray[index] = value;
99      }
100 
101     /**
102      * Setter for the String[] property.
103      */
104     public void setStringArray(final String[] stringArray) {
105         this.stringArray = stringArray;
106     }
107 
108     /**
109      * Indexed Setter for the java.util.List property.
110      */
111     public void setStringList(final int index, final String value) {
112         stringList.add(index, value);
113     }
114 
115     /**
116      * Setter for the java.util.List property.
117      */
118     public void setStringList(final List<String> stringList) {
119         this.stringList = stringList;
120     }
121 
122 }