View Javadoc

1   package org.apache.maven.doxia.macro;
2   
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  
22  import java.util.Map;
23  import java.io.File;
24  
25  /**
26   * <p>MacroRequest class.</p>
27   *
28   * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
29   * @version $Id: MacroRequest.java 1090706 2011-04-09 23:15:28Z hboutemy $
30   * @since 1.0
31   */
32  public class MacroRequest
33  {
34      /** The current base directory. */
35      private File basedir;
36  
37      /** A map of parameters. */
38      private Map<String, Object> parameters;
39  
40      /**
41       * Constructor.
42       *
43       * @param param A map of parameters.
44       * @param base The current base directory.
45       */
46      public MacroRequest( Map<String, Object> param, File base )
47      {
48          this.parameters = param;
49          this.basedir = base;
50      }
51  
52      /**
53       * Returns the current base directory.
54       *
55       * @return The base dir.
56       */
57      public File getBasedir()
58      {
59          return basedir;
60      }
61  
62      /**
63       * Sets the current base directory.
64       *
65       * @param base The current base directory.
66       */
67      public void setBasedir( File base )
68      {
69          this.basedir = base;
70      }
71  
72      /**
73       * Returns the map of parameters.
74       *
75       * @return The map of parameters.
76       */
77      public Map<String, Object> getParameters()
78      {
79          return parameters;
80      }
81  
82      /**
83       * Returns on object from the map of parameters
84       * that corresponds to the given key.
85       *
86       * @param key The key to lookup the object.
87       * @return The value object.
88       */
89      public Object getParameter( String key )
90      {
91          return parameters.get( key );
92      }
93  }