This project has retired. For details please refer to its Attic page.
StateAwareParameterMap xref
View Javadoc

1   /*
2    * $Id: StateAwareParameterMap.java 1066849 2011-02-03 16:12:39Z apetrelli $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  package org.apache.tiles.request.portlet.delegate;
22  
23  import java.util.Collection;
24  import java.util.Map;
25  import java.util.Set;
26  
27  /**
28   * Parameter map to be used when the response is a {@link javax.portlet.StateAwareResponse}.
29   *
30   * @version $Rev: 1066849 $ $Date: 2011-02-04 03:12:39 +1100 (Fri, 04 Feb 2011) $
31   */
32  public class StateAwareParameterMap implements Map<String, String[]> {
33  
34      /**
35       * The request parameter map.
36       */
37      private Map<String, String[]> requestMap;
38  
39      /**
40       * The response parameter map.
41       */
42      private Map<String, String[]> responseMap;
43  
44      /**
45       * Constructor.
46       *
47       * @param requestMap The request parameter map.
48       * @param responseMap The response parameter map.
49       */
50      public StateAwareParameterMap(Map<String, String[]> requestMap,
51              Map<String, String[]> responseMap) {
52          this.requestMap = requestMap;
53          this.responseMap = responseMap;
54      }
55  
56      @Override
57      public void clear() {
58          responseMap.clear();
59      }
60  
61      @Override
62      public boolean containsKey(Object key) {
63          return requestMap.containsKey(key);
64      }
65  
66      @Override
67      public boolean containsValue(Object value) {
68          return requestMap.containsValue(value);
69      }
70  
71      @Override
72      public Set<java.util.Map.Entry<String, String[]>> entrySet() {
73          return requestMap.entrySet();
74      }
75  
76      @Override
77      public String[] get(Object key) {
78          return requestMap.get(key);
79      }
80  
81      @Override
82      public boolean isEmpty() {
83          return requestMap.isEmpty();
84      }
85  
86      @Override
87      public Set<String> keySet() {
88          return requestMap.keySet();
89      }
90  
91      @Override
92      public String[] put(String key, String[] value) {
93          return responseMap.put(key, value);
94      }
95  
96      @Override
97      public void putAll(Map<? extends String, ? extends String[]> m) {
98          responseMap.putAll(m);
99      }
100 
101     @Override
102     public String[] remove(Object key) {
103         return responseMap.remove(key);
104     }
105 
106     @Override
107     public int size() {
108         return requestMap.size();
109     }
110 
111     @Override
112     public Collection<String[]> values() {
113         return requestMap.values();
114     }
115 }