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

File WikiMacro.java

 

Coverage histogram

../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

14
27
9
1
135
74
16
0.59
3
9
1.78

Classes

Class Line # Actions
WikiMacro 38 27 0% 16 50
0.00%
 

Contributing tests

No tests hitting this source file were found.

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.wikimodel;
21   
22    /**
23    * An immutable object which holds information about a macro reference.
24    * Macros are unique just by their name.
25    * The content and parameters are optional.<br>
26    * <br>
27    * There are a few 'built in' macro names:
28    * <ul>
29    * <li>toc</li>
30    * <li>notoc</li>
31    * <li>forcetoc</li>
32    * <li>footnotes</li>
33    * </ul>
34    *
35    * @version $Id: b64605b66faa61830b30f33e412ceb2bf904855b $
36    * @since 4.0M1
37    */
 
38    public class WikiMacro
39    {
40    public final static String MACRO_TOC = "toc";
41   
42    public final static String MACRO_NOTOC = "notoc";
43   
44    public final static String MACRO_FORCETOC = "forcetoc";
45   
46    public final static String MACRO_FOOTNOTES = "footnotes";
47   
48    public final static String UNHANDLED_MACRO = "unhandled";
49   
50    private final String name;
51   
52    private final WikiParameters wikiParameters;
53   
54    private final String content;
55   
 
56  0 toggle public WikiMacro(String name)
57    {
58  0 this(name, WikiParameters.EMPTY, null);
59    }
60   
 
61  0 toggle public WikiMacro(String name, WikiParameters wikiParameters)
62    {
63  0 this(name, wikiParameters, null);
64    }
65   
 
66  0 toggle public WikiMacro(String name, WikiParameters wikiParameters, String content)
67    {
68  0 super();
69  0 this.name = name;
70  0 this.content = content;
71  0 this.wikiParameters = wikiParameters;
72    }
73   
74    /**
75    * @return the name
76    */
 
77  0 toggle public String getName()
78    {
79  0 return name;
80    }
81   
82    /**
83    * @return the content
84    */
 
85  0 toggle public String getContent()
86    {
87  0 return content;
88    }
89   
90    /**
91    * @return the wikiParameters
92    */
 
93  0 toggle public WikiParameters getWikiParameters()
94    {
95  0 return wikiParameters;
96    }
97   
 
98  0 toggle @Override
99    public int hashCode()
100    {
101  0 final int prime = 31;
102  0 int result = 1;
103  0 result = prime * result + ((name == null) ? 0 : name.hashCode());
104  0 return result;
105    }
106   
 
107  0 toggle @Override
108    public boolean equals(Object obj)
109    {
110  0 if (this == obj) {
111  0 return true;
112    }
113  0 if (obj == null) {
114  0 return false;
115    }
116  0 if (getClass() != obj.getClass()) {
117  0 return false;
118    }
119  0 WikiMacro other = (WikiMacro) obj;
120  0 if (name == null) {
121  0 if (other.name != null) {
122  0 return false;
123    }
124  0 } else if (!name.equals(other.name)) {
125  0 return false;
126    }
127  0 return true;
128    }
129   
 
130  0 toggle @Override
131    public String toString()
132    {
133  0 return "{{" + name + " | " + content + " | " + wikiParameters + "}}";
134    }
135    }