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    *      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  
38      public String getMapproperty(final String key) {
39          return (String) map.get(key);
40      }
41  
42      public void setMapproperty(final String key, final String value) {
43          map.put(key, value);
44      }
45  
46      public boolean isMappedBoolean(final String key) {
47          return ((Boolean)map.get(key)).booleanValue();
48      }
49  
50      public void setMappedBoolean(final String key, final boolean value) {
51          map.put(key, (value ? Boolean.TRUE : Boolean.FALSE));
52      }
53  
54      protected String getProtectedMapped(final String key) {
55          return (String) map.get(key);
56      }
57  
58      protected void setProtectedMapped(final String key, final String value) {
59          map.put(key, value);
60      }
61  
62      public void setMappedPrimitive(final int key, final int value) {
63          map.put(new Integer(key), new Integer(value));
64      }
65  
66      public void setAnyMapped(final MappedPropertyTestBean key, final MappedPropertyTestBean value) {
67          map.put(key, value);
68      }
69  
70      public void setMappedSetterOnly(final String key, final String value) {
71          map.put(key, value);
72      }
73  
74      public String getMappedGetterOnly(final String key) {
75          return (String) map.get(key);
76      }
77  
78      public String getInvalidGetter(final String key, final String other) {
79          return (String) map.get(key);
80      }
81      public Map<Object, Object> getMyMap() {
82          return myMap;
83      }
84  
85      public void setInvalidGetter(final String key, final String value) {
86          map.put(key, value);
87      }
88      public String getInvalidSetter(final String key) {
89          return (String) map.get(key);
90      }
91      public void setInvalidSetter(final String key, final String value, final String other) {
92      }
93  
94      public Long getDifferentTypes(final String key) {
95          return new Long(((Number)map.get(key)).longValue());
96      }
97      public void setDifferentTypes(final String key, final Integer value) {
98          map.put(key, value);
99      }
100 
101 }