1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.filter.type

File SystemType.java

 

Coverage histogram

../../../../img/srcFileCovDistChart8.png
56% of files have more coverage

Code metrics

4
13
7
1
128
52
9
0.69
1.86
7
1.29

Classes

Class Line # Actions
SystemType 30 13 0% 9 6
0.7575%
 

Contributing tests

This file is covered by 99 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.filter.type;
21   
22    import java.util.Objects;
23   
24    /**
25    * Represents various systems.
26    *
27    * @version $Id: ef4080138aa34f423c635248ba8398a1fb0b902c $
28    * @since 6.2M1
29    */
 
30    public class SystemType
31    {
32    /**
33    * MediaWiki wiki type.
34    */
35    public static final SystemType MEDIAWIKI = new SystemType("mediawiki");
36   
37    /**
38    * DokuWiki wiki type.
39    *
40    * @since 9.5RC1
41    */
42    public static final SystemType DOKUWIKI = new SystemType("dokuwiki");
43   
44    /**
45    * Confluence wiki type.
46    */
47    public static final SystemType CONFLUENCE = new SystemType("confluence");
48   
49    /**
50    * XWiki wiki type.
51    */
52    public static final SystemType XWIKI = new SystemType("xwiki");
53   
54    /**
55    * Generic filter.
56    */
57    public static final SystemType FILTER = new SystemType("filter");
58   
59    /**
60    * Id of a Wiki.
61    */
62    private String id;
63   
64    /**
65    * @param id of a wiki
66    */
 
67  351 toggle public SystemType(String id)
68    {
69  351 this.id = id.toLowerCase();
70    }
71   
72    /**
73    * Create a new {@link SystemType} from a {@link String}.
74    *
75    * @param str the {@link String} to parse
76    * @return a {@link SystemType}
77    */
 
78  46 toggle public static SystemType unserialize(String str)
79    {
80  46 return new SystemType(str);
81    }
82   
83    /**
84    * @return id of the wiki
85    */
 
86  34985 toggle public String getId()
87    {
88  34986 return this.id;
89    }
90   
91    /**
92    * @return a {@link String} representation of the {@link FilterStreamType}
93    */
 
94  34970 toggle public String serialize()
95    {
96  34971 return getId();
97    }
98   
 
99  90 toggle @Override
100    public String toString()
101    {
102  90 return serialize();
103    }
104   
 
105  0 toggle @Override
106    public int hashCode()
107    {
108  0 return getId().hashCode();
109    }
110   
 
111  5 toggle @Override
112    public boolean equals(Object object)
113    {
114  5 boolean result;
115   
116  5 if (this == object) {
117  0 result = true;
118    } else {
119  5 if (object instanceof SystemType) {
120  5 result = Objects.equals(getId(), ((SystemType) object).getId());
121    } else {
122  0 result = false;
123    }
124    }
125   
126  5 return result;
127    }
128    }