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 import java.util.HashMap;
22 import java.util.Map;
23 
24 /**
25  * Just a java bean (JAJB) to try to replicate a reported bug
26  *
27  * @version $Id$
28  */
29 
30 public class MappedPropertyTestBean {
31 
32     private final Map<Object, Object> map = new HashMap<Object, Object>();
33     private final Map<Object, Object> myMap = new HashMap<Object, Object>();
34 
35 
36     // -------------------------------------------------------------- Properties
37 
getMapproperty(final String key)38     public String getMapproperty(final String key) {
39         return (String) map.get(key);
40     }
41 
setMapproperty(final String key, final String value)42     public void setMapproperty(final String key, final String value) {
43         map.put(key, value);
44     }
45 
isMappedBoolean(final String key)46     public boolean isMappedBoolean(final String key) {
47         return ((Boolean)map.get(key)).booleanValue();
48     }
49 
setMappedBoolean(final String key, final boolean value)50     public void setMappedBoolean(final String key, final boolean value) {
51         map.put(key, (value ? Boolean.TRUE : Boolean.FALSE));
52     }
53 
getProtectedMapped(final String key)54     protected String getProtectedMapped(final String key) {
55         return (String) map.get(key);
56     }
57 
setProtectedMapped(final String key, final String value)58     protected void setProtectedMapped(final String key, final String value) {
59         map.put(key, value);
60     }
61 
setMappedPrimitive(final int key, final int value)62     public void setMappedPrimitive(final int key, final int value) {
63         map.put(new Integer(key), new Integer(value));
64     }
65 
setAnyMapped(final MappedPropertyTestBean key, final MappedPropertyTestBean value)66     public void setAnyMapped(final MappedPropertyTestBean key, final MappedPropertyTestBean value) {
67         map.put(key, value);
68     }
69 
setMappedSetterOnly(final String key, final String value)70     public void setMappedSetterOnly(final String key, final String value) {
71         map.put(key, value);
72     }
73 
getMappedGetterOnly(final String key)74     public String getMappedGetterOnly(final String key) {
75         return (String) map.get(key);
76     }
77 
getInvalidGetter(final String key, final String other)78     public String getInvalidGetter(final String key, final String other) {
79         return (String) map.get(key);
80     }
getMyMap()81     public Map<Object, Object> getMyMap() {
82         return myMap;
83     }
84 
setInvalidGetter(final String key, final String value)85     public void setInvalidGetter(final String key, final String value) {
86         map.put(key, value);
87     }
getInvalidSetter(final String key)88     public String getInvalidSetter(final String key) {
89         return (String) map.get(key);
90     }
setInvalidSetter(final String key, final String value, final String other)91     public void setInvalidSetter(final String key, final String value, final String other) {
92     }
93 
getDifferentTypes(final String key)94     public Long getDifferentTypes(final String key) {
95         return new Long(((Number)map.get(key)).longValue());
96     }
setDifferentTypes(final String key, final Integer value)97     public void setDifferentTypes(final String key, final Integer value) {
98         map.put(key, value);
99     }
100 
101 }
102