001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018package org.apache.commons.jexl.context; 019 020import org.apache.commons.jexl.JexlContext; 021 022import java.util.HashMap; 023import java.util.Map; 024 025/** 026 * Implementation of JexlContext based on a HashMap. 027 * 028 * @since 1.0 029 * 030 * @version $Id$ 031 */ 032public class HashMapContext extends HashMap<String,Object> implements JexlContext { 033 /** serialization version id jdk13 generated. */ 034 private static final long serialVersionUID = 5715964743204418854L; 035 /** 036 * {@inheritDoc} 037 */ 038 public void setVars(Map<String,Object> vars) { 039 clear(); 040 putAll(vars); 041 } 042 043 /** 044 * {@inheritDoc} 045 */ 046 public Map<String,Object> getVars() { 047 return this; 048 } 049}