1/*2 * $Id: VelocityScopeMap.java 942431 2010-05-08 18:05:19Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.request.velocity;
2223import java.util.HashSet;
24import java.util.Set;
2526import org.apache.tiles.request.collection.ScopeMap;
27import org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor;
28import org.apache.velocity.context.Context;
2930/**31 * <p>Private implementation of <code>Map</code> for servlet request32 * attributes.</p>33 *34 * @version $Rev: 942431 $ $Date: 2010-05-09 04:05:19 +1000 (Sun, 09 May 2010) $35 */3637finalclassVelocityScopeMapextendsScopeMap {
3839/**40 * The request object to use.41 */42private Context request = null;
4344/**45 * Constructor.46 *47 * @param request The request object to use.48 */49publicVelocityScopeMap(Context request) {
50super(newVelocityScopeExtractor(request));
51this.request = request;
52 }
5354 @Override
55public Object remove(Object key) {
56return request.remove(key);
57 }
5859 @Override
60public Object put(String key, Object value) {
61return request.put(key, value);
62 }
6364/** {@inheritDoc} */65publicboolean containsKey(Object key) {
66return request.containsKey(key);
67 }
686970/** {@inheritDoc} */71publicboolean isEmpty() {
72return size() < 1;
73 }
747576/** {@inheritDoc} */77public Set<String> keySet() {
78 Set<String> set = new HashSet<String>();
79for (Object key : request.getKeys()) {
80 set.add((String) key);
81 }
82return (set);
83 }
8485/** {@inheritDoc} */86publicint size() {
87return request.getKeys().length;
88 }
89 }