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

File WikiMacroParameterDescriptor.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart7.png
64% of files have more coverage

Code metrics

0
14
9
1
136
60
9
0.64
1.56
9
1

Classes

Class Line # Actions
WikiMacroParameterDescriptor 32 14 0% 9 8
0.6521739465.2%
 

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.lang.reflect.Type;
23   
24    import org.xwiki.rendering.macro.descriptor.ParameterDescriptor;
25   
26    /**
27    * {@link ParameterDescriptor} for describing wiki macro parameters.
28    *
29    * @version $Id: 6c22db6f5a3091ab1a2bdc221709367164865cad $
30    * @since 2.0M2
31    */
 
32    public class WikiMacroParameterDescriptor implements ParameterDescriptor
33    {
34    /**
35    * Identifier of the parameter.
36    *
37    * @since 2.1M1
38    */
39    private String id;
40   
41    /**
42    * Display name of the parameter.
43    *
44    * @since 2.1M1
45    */
46    private String name;
47   
48    /**
49    * Description of the parameter.
50    */
51    private String description;
52   
53    /**
54    * Boolean indicating if the parameter is mandatory.
55    */
56    private boolean mandatory;
57   
58    /**
59    * Default value of the parameter.
60    */
61    private Object defaultValue;
62   
63    /**
64    * Creates a new {@link WikiMacroParameterDescriptor} instance.
65    *
66    * @param id parameter identifier.
67    * @param description parameter description.
68    * @param mandatory if the parameter is mandatory.
69    */
 
70  18 toggle public WikiMacroParameterDescriptor(String id, String description, boolean mandatory)
71    {
72  18 this.id = id;
73  18 this.description = description;
74  18 this.mandatory = mandatory;
75    }
76   
77    /**
78    * Creates a new {@link WikiMacroParameterDescriptor} instance.
79    *
80    * @param id parameter identifier.
81    * @param description parameter description.
82    * @param mandatory if the parameter is mandatory.
83    * @param defaultValue parameter default value.
84    * @since 2.3M1
85    */
 
86  1851 toggle public WikiMacroParameterDescriptor(String id, String description, boolean mandatory, Object defaultValue)
87    {
88  1851 this.id = id;
89  1851 this.description = description;
90  1851 this.mandatory = mandatory;
91  1851 this.defaultValue = defaultValue;
92    }
93   
 
94  1227 toggle @Override
95    public String getId()
96    {
97  1227 return this.id;
98    }
99   
 
100  0 toggle @Override
101    public String getName()
102    {
103  0 return this.name;
104    }
105   
 
106  0 toggle @Override
107    public String getDescription()
108    {
109  0 return this.description;
110    }
111   
 
112  0 toggle @Override
113    @Deprecated
114    public Class< ? > getType()
115    {
116  0 return String.class;
117    }
118   
 
119  0 toggle @Override
120    public Type getParameterType()
121    {
122  0 return getType();
123    }
124   
 
125  1225 toggle @Override
126    public Object getDefaultValue()
127    {
128  1225 return this.defaultValue;
129    }
130   
 
131  1225 toggle @Override
132    public boolean isMandatory()
133    {
134  1225 return mandatory;
135    }
136    }