001package org.apache.maven.doxia.macro;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.Map;
023import java.io.File;
024
025/**
026 * <p>MacroRequest class.</p>
027 *
028 * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
029 * @version $Id$
030 * @since 1.0
031 */
032public class MacroRequest
033{
034    /** The current base directory. */
035    private File basedir;
036
037    /** A map of parameters. */
038    private Map<String, Object> parameters;
039
040    /**
041     * Constructor.
042     *
043     * @param param A map of parameters.
044     * @param base The current base directory.
045     */
046    public MacroRequest( Map<String, Object> param, File base )
047    {
048        this.parameters = param;
049        this.basedir = base;
050    }
051
052    /**
053     * Returns the current base directory.
054     *
055     * @return The base dir.
056     */
057    public File getBasedir()
058    {
059        return basedir;
060    }
061
062    /**
063     * Sets the current base directory.
064     *
065     * @param base The current base directory.
066     */
067    public void setBasedir( File base )
068    {
069        this.basedir = base;
070    }
071
072    /**
073     * Returns the map of parameters.
074     *
075     * @return The map of parameters.
076     */
077    public Map<String, Object> getParameters()
078    {
079        return parameters;
080    }
081
082    /**
083     * Returns on object from the map of parameters
084     * that corresponds to the given key.
085     *
086     * @param key The key to lookup the object.
087     * @return The value object.
088     */
089    public Object getParameter( String key )
090    {
091        return parameters.get( key );
092    }
093}