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

File SystemType.java

 

Coverage histogram

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

Code metrics

4
13
7
1
121
51
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 85 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: 98e0ca72d32ae8f0b65eee61a83a87678e170557 $
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    * Confluence wiki type.
39    */
40    public static final SystemType CONFLUENCE = new SystemType("confluence");
41   
42    /**
43    * XWiki wiki type.
44    */
45    public static final SystemType XWIKI = new SystemType("xwiki");
46   
47    /**
48    * Generic filter.
49    */
50    public static final SystemType FILTER = new SystemType("filter");
51   
52    /**
53    * Id of a Wiki.
54    */
55    private String id;
56   
57    /**
58    * @param id of a wiki
59    */
 
60  235 toggle public SystemType(String id)
61    {
62  235 this.id = id.toLowerCase();
63    }
64   
65    /**
66    * Create a new {@link SystemType} from a {@link String}.
67    *
68    * @param str the {@link String} to parse
69    * @return a {@link SystemType}
70    */
 
71  46 toggle public static SystemType unserialize(String str)
72    {
73  46 return new SystemType(str);
74    }
75   
76    /**
77    * @return id of the wiki
78    */
 
79  12736 toggle public String getId()
80    {
81  12736 return this.id;
82    }
83   
84    /**
85    * @return a {@link String} representation of the {@link FilterStreamType}
86    */
 
87  12730 toggle public String serialize()
88    {
89  12730 return getId();
90    }
91   
 
92  88 toggle @Override
93    public String toString()
94    {
95  88 return serialize();
96    }
97   
 
98  0 toggle @Override
99    public int hashCode()
100    {
101  0 return getId().hashCode();
102    }
103   
 
104  1 toggle @Override
105    public boolean equals(Object object)
106    {
107  1 boolean result;
108   
109  1 if (this == object) {
110  0 result = true;
111    } else {
112  1 if (object instanceof SystemType) {
113  1 result = Objects.equals(getId(), ((SystemType) object).getId());
114    } else {
115  0 result = false;
116    }
117    }
118   
119  1 return result;
120    }
121    }