View Javadoc

1   /*
2    * $Id: BaseObjectIndexed.java 1103095 2011-05-14 13:18:29Z simonetripodi $
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   * http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  package org.apache.commons.ognl.test.objects;
21  
22  import java.util.*;
23  
24  public class BaseObjectIndexed
25      extends Object
26  {
27      private Map attributes = new HashMap();
28  
29      public BaseObjectIndexed()
30      {
31          super();
32      }
33  
34      public Map getAttributes()
35      {
36          return attributes;
37      }
38  
39      public Object getAttribute( String name )
40      {
41          return attributes.get( name );
42      }
43  
44      public void setAttribute( String name, Object value )
45      {
46          attributes.put( name, value );
47      }
48  
49      /* allow testing property name where types do not match */
50      public Object getOtherAttribute( String name )
51      {
52          return null;
53      }
54  
55      public void setOtherAttribute( Object someObject, Object foo )
56      {
57          /* do nothing */
58      }
59  
60      /* test whether get only is found */
61      public Object getSecondaryAttribute( Object name )
62      {
63          return attributes.get( name );
64      }
65  }