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