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:
018: package org.apache.commons.beanutils;
019:
020: import java.util.HashMap;
021: import java.util.Map;
022:
023: /**
024: * Just a java bean (JAJB) to try to replicate a reported bug
025: *
026: * @author Robert Burrell Donkin
027: * @version $Revision: 438363 $ $Date: 2006-08-30 05:48:00 +0100 (Wed, 30 Aug 2006) $
028: */
029:
030: public class MappedPropertyTestBean {
031:
032: private Map map = new HashMap();
033: private Map myMap = new HashMap();
034:
035: // -------------------------------------------------------------- Properties
036:
037: public String getMapproperty(String key) {
038: return (String) map.get(key);
039: }
040:
041: public void setMapproperty(String key, String value) {
042: map.put(key, value);
043: }
044:
045: public boolean isMappedBoolean(String key) {
046: return ((Boolean) map.get(key)).booleanValue();
047: }
048:
049: public void setMappedBoolean(String key, boolean value) {
050: map.put(key, (value ? Boolean.TRUE : Boolean.FALSE));
051: }
052:
053: protected String getProtectedMapped(String key) {
054: return (String) map.get(key);
055: }
056:
057: protected void setProtectedMapped(String key, String value) {
058: map.put(key, value);
059: }
060:
061: public void setMappedPrimitive(int key, int value) {
062: map.put(new Integer(key), new Integer(value));
063: }
064:
065: public void setAnyMapped(MappedPropertyTestBean key,
066: MappedPropertyTestBean value) {
067: map.put(key, value);
068: }
069:
070: public void setMappedSetterOnly(String key, String value) {
071: map.put(key, value);
072: }
073:
074: public String getMappedGetterOnly(String key) {
075: return (String) map.get(key);
076: }
077:
078: public String getInvalidGetter(String key, String other) {
079: return (String) map.get(key);
080: }
081:
082: public Map getMyMap() {
083: return myMap;
084: }
085:
086: public void setInvalidGetter(String key, String value) {
087: map.put(key, value);
088: }
089:
090: public String getInvalidSetter(String key) {
091: return (String) map.get(key);
092: }
093:
094: public void setInvalidSetter(String key, String value, String other) {
095: }
096:
097: public Long getDifferentTypes(String key) {
098: return new Long(((Number) map.get(key)).longValue());
099: }
100:
101: public void setDifferentTypes(String key, Integer value) {
102: map.put(key, value);
103: }
104:
105: }
|