1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.macro.wikibridge

File WikiMacroParameters.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
4
4
1
76
27
4
1
1
4
1

Classes

Class Line # Actions
WikiMacroParameters 35 4 0% 4 0
1.0100%
 

Contributing tests

This file is covered by 9 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.macro.wikibridge;
21   
22    import java.util.Collections;
23    import java.util.HashMap;
24    import java.util.Map;
25    import java.util.Set;
26   
27    import org.xwiki.properties.RawProperties;
28   
29    /**
30    * Generic parameters class for all wiki macros.
31    *
32    * @version $Id: a01be1c0c1d311dc40a7dd28038baed439abe4b9 $
33    * @since 2.0M2
34    */
 
35    public class WikiMacroParameters implements RawProperties
36    {
37    /**
38    * A map holding all the parameter and their values.
39    */
40    private Map<String, Object> parametersMap;
41   
42    /**
43    * Creates a new {@link WikiMacroParameters} instance.
44    */
 
45  170 toggle public WikiMacroParameters()
46    {
47  170 this.parametersMap = new HashMap<String, Object>();
48    }
49   
 
50  881 toggle @Override
51    public void set(String propertyName, Object value)
52    {
53  881 this.parametersMap.put(propertyName, value);
54    }
55   
56    /**
57    * Returns the set of parameter names provided by user.
58    *
59    * @return set of parameter names provided by user
60    */
 
61  52 toggle public Set<String> getParameterNames()
62    {
63  52 return Collections.unmodifiableSet(this.parametersMap.keySet());
64    }
65   
66    /**
67    * Returns the parameter value associated with the propertyName provided.
68    *
69    * @param propertyName the property name.
70    * @return the property value if set, null otherwise.
71    */
 
72  2852 toggle public Object get(String propertyName)
73    {
74  2852 return this.parametersMap.get(propertyName);
75    }
76    }