001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.commons.beanutils.bugs.other;
018:
019: import java.util.HashMap;
020: import java.util.Map;
021:
022: import org.apache.commons.beanutils.bugs.Jira61TestCase;
023:
024: /**
025: * Factory which creates beans for {@link Jira61TestCase}.
026: *
027: * @version $Revision: 553357 $ $Date: 2007-07-05 02:10:25 +0100 (Thu, 05 Jul 2007) $
028: */
029: public class Jira61BeanFactory {
030:
031: /**
032: * Factory method which creates a new {@link TestBean}.
033: *
034: * @return a new {@link TestBean}.
035: */
036: public static TestBean createBean() {
037: return new TestBean();
038: }
039:
040: /**
041: * Test Bean
042: */
043: public static class TestBean {
044:
045: private String[] indexed = new String[] { "one", "two", "three" };
046: private String simple = "FOO";
047: private Map mapped = new HashMap();
048:
049: /** Default Constructor */
050: public TestBean() {
051: mapped.put("foo-key", "foo-value");
052: mapped.put("bar-key", "bar-value");
053: }
054:
055: /**
056: * Return simpleReadOnly
057: *
058: * @return the simple value
059: */
060: public String getSimpleReadOnly() {
061: return simple;
062: }
063:
064: /**
065: * Set simpleWriteOnly
066: *
067: * @param simple simple value
068: */
069: public void setSimpleWriteOnly(String simple) {
070: this .simple = simple;
071: }
072:
073: /**
074: * Return indexed property.
075: *
076: * @param index The index
077: * @return The indexed value
078: */
079: public String getIndexedReadOnly(int index) {
080: return indexed[index];
081: }
082:
083: /**
084: * Set indexed property.
085: *
086: * @param index The index
087: * @param value The indexed value
088: */
089: public void setIndexedWriteOnly(int index, String value) {
090: this .indexed[index] = value;
091: }
092:
093: /**
094: * Return mapped property.
095: *
096: * @param key The mapped key
097: * @return The mapped value
098: */
099: public String getMappedReadOnly(String key) {
100: return (String) mapped.get(key);
101: }
102:
103: /**
104: * Set mapped property.
105: *
106: * @param key The mapped key
107: * @param value The mapped value
108: */
109: public void setMappedWriteOnly(String key, String value) {
110: mapped.put(key, value);
111: }
112:
113: }
114:
115: }
|