View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.shared.util.el;
20  
21  import java.util.Collection;
22  import java.util.Map;
23  import java.util.Set;
24  
25  public abstract class GenericMap implements Map
26  {
27  
28      /**
29       * This method should return the result of the test.
30       */
31      protected abstract Object getValue(Object key);
32  
33      public int size()
34      {
35          return 1;
36      }
37  
38      public boolean isEmpty()
39      {
40          return false;
41      }
42  
43      public boolean containsKey(Object key)
44      {
45          return true;
46      }
47  
48      public boolean containsValue(Object value)
49      {
50          return value instanceof Boolean;
51      }
52  
53      public Object get(Object key)
54      {
55          return getValue(key);
56      }
57  
58      public Object put(Object key, Object value)
59      {
60          return null;
61      }
62  
63      public Object remove(Object key)
64      {
65          return null;
66      }
67  
68      public void putAll(Map m)
69      {
70          // NoOp
71      }
72  
73      public void clear()
74      {
75          // NoOp
76      }
77  
78      public Set keySet()
79      {
80          return null;
81      }
82  
83      public Collection values()
84      {
85          return null;
86      }
87  
88      public Set entrySet()
89      {
90          return null;
91      }
92  }
93  
94