1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.rendering.macro.descriptor

File DefaultContentDescriptor.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart9.png
41% of files have more coverage

Code metrics

0
9
8
1
119
45
8
0.89
1.12
8
1

Classes

Class Line # Actions
DefaultContentDescriptor 30 9 0% 8 2
0.8823529588.2%
 

Contributing tests

This file is covered by 193 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.descriptor;
21   
22    import java.lang.reflect.Type;
23   
24    /**
25    * The default implementation of {@link ContentDescriptor}.
26    *
27    * @version $Id: 79fb573796ce1ba2eb909f425ecb3d4e70a743ae $
28    * @since 1.9M1
29    */
 
30    public class DefaultContentDescriptor implements ContentDescriptor
31    {
32    /**
33    * Default content type of all content descriptors.
34    *
35    * @since 10.9
36    */
37    public static final Type DEFAULT_CONTENT_TYPE = String.class;
38   
39    /**
40    * The description of the content.
41    */
42    private String description;
43   
44    /**
45    * Indicate if the content is mandatory.
46    */
47    private boolean mandatory = true;
48   
49    /**
50    * Type of the Macro content.
51    *
52    * @since 10.10RC1
53    */
54    private Type type = DEFAULT_CONTENT_TYPE;
55   
56    /**
57    * Default constructor.
58    */
 
59  17 toggle public DefaultContentDescriptor()
60    {
61    }
62   
63    /**
64    * @param description the description of the content.
65    */
 
66  245 toggle public DefaultContentDescriptor(String description)
67    {
68  245 this.description = description;
69    }
70   
71    /**
72    * @param mandatory indicate if the content is mandatory.
73    */
 
74  11 toggle public DefaultContentDescriptor(boolean mandatory)
75    {
76  11 this.mandatory = mandatory;
77    }
78   
79    /**
80    * @param description the description of the content.
81    * @param mandatory indicate if the content is mandatory.
82    */
 
83  581 toggle public DefaultContentDescriptor(String description, boolean mandatory)
84    {
85  581 this(description, mandatory, String.class);
86    }
87   
88    /**
89    * @param description the description of the content.
90    * @param mandatory indicate if the content is mandatory.
91    * @param type Specify the type of the content
92    *
93    * @since 10.10RC1
94    */
 
95  694 toggle public DefaultContentDescriptor(String description, boolean mandatory, Type type)
96    {
97  694 this.description = description;
98  694 this.mandatory = mandatory;
99  694 this.type = type;
100    }
101   
 
102  0 toggle @Override
103    public String getDescription()
104    {
105  0 return this.description;
106    }
107   
 
108  178 toggle @Override
109    public boolean isMandatory()
110    {
111  178 return this.mandatory;
112    }
113   
 
114  6822 toggle @Override
115    public Type getType()
116    {
117  6824 return this.type;
118    }
119    }