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 */
017package org.apache.commons.jexl;
018
019import java.util.Map;
020
021/**
022 * Holds a Map of variables which are referenced in a JEXL expression.
023 *
024 *  @since 1.0
025 *  
026 *  @version $Id$
027 */
028public interface JexlContext {
029    /**
030     * Replaces variables in a JexlContext with the variables contained
031     * in the supplied Map.  When setVars() is called on a JexlContext,
032     * it clears the current Map and puts each entry of the
033     * supplied Map into the current variable Map.
034     *
035     * @param vars Contents of vars will be replaced with the content
036     *      of this Map
037     */
038    void setVars(Map<String,Object> vars);
039
040    /**
041     * Retrives the Map of variables associated with this JexlContext.  The
042     * keys of this map correspond to variable names referenced in a
043     * JEXL expression.
044     *
045     * @return A reference to the variable Map associated with this JexlContext.
046     */
047    Map<String,Object> getVars();
048}