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.Jira18TestCase;
023:
024: /**
025: * Factory whcih creates <i>package</i> scope beans with
026: * public methods for {@link Jira18TestCase}.
027: *
028: * @version $Revision: 556237 $ $Date: 2007-07-14 08:27:18 +0100 (Sat, 14 Jul 2007) $
029: */
030: public class Jira18BeanFactory {
031:
032: /**
033: * Factory method which creates package friendly beans.
034: *
035: * @return The a package friendly bean with public methods
036: */
037: public static Object createBean() {
038: return new PackageFriendlyBean();
039: }
040:
041: /* =============== Package Friendly Bean =============== */
042: static class PackageFriendlyBean {
043:
044: private String[] indexed = new String[] { "one", "two", "three" };
045: private String simple = "FOO";
046: private Map mapped = new HashMap();
047:
048: /** Default Constructor */
049: public PackageFriendlyBean() {
050: mapped.put("foo-key", "foo-value");
051: mapped.put("bar-key", "bar-value");
052: }
053:
054: /**
055: * Return simple property.
056: *
057: * @return The simple value
058: */
059: public String getSimple() {
060: return simple;
061: }
062:
063: /**
064: * Set simple property.
065: *
066: * @param simple The simple value
067: */
068: public void setSimple(String simple) {
069: this .simple = simple;
070: }
071:
072: /**
073: * Return indexed property.
074: *
075: * @param index The index
076: * @return The indexed value
077: */
078: public String getIndexed(int index) {
079: return indexed[index];
080: }
081:
082: /**
083: * Set indexed property.
084: *
085: * @param index The index
086: * @param value The indexed value
087: */
088: public void setIndexed(int index, String value) {
089: this .indexed[index] = value;
090: }
091:
092: /**
093: * Return mapped property.
094: *
095: * @param key The mapped key
096: * @return The mapped value
097: */
098: public String getMapped(String key) {
099: return (String) mapped.get(key);
100: }
101:
102: /**
103: * Set mapped property.
104: *
105: * @param key The mapped key
106: * @param value The mapped value
107: */
108: public void setMapped(String key, String value) {
109: mapped.put(key, value);
110: }
111:
112: }
113:
114: }
|