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

File ResourceType.java

 

Coverage histogram

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

Code metrics

6
12
5
1
85
44
8
0.67
2.4
5
1.6

Classes

Class Line # Actions
ResourceType 31 12 0% 8 4
0.8260869482.6%
 

Contributing tests

This file is covered by 22 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.resource;
21   
22    import org.apache.commons.lang3.builder.EqualsBuilder;
23    import org.apache.commons.lang3.builder.HashCodeBuilder;
24   
25    /**
26    * Represents the type of Resource (eg Entity, Temporary, etc).
27    *
28    * @version $Id: 62705cc8f43d45bae4074f169418cf9a662a4f6c $
29    * @since 6.1M2
30    */
 
31    public class ResourceType
32    {
33    /**
34    * The resource type id (e.g. "bin", "tmp", etc).
35    */
36    private String id;
37   
38    /**
39    * @param id see {@link #getId()}
40    */
 
41  6774 toggle public ResourceType(String id)
42    {
43  6773 this.id = id;
44    }
45   
46    /**
47    * @return the technical id of the Resource Type
48    */
 
49  173713 toggle public String getId()
50    {
51  173802 return this.id;
52    }
53   
 
54  9475 toggle @Override
55    public String toString()
56    {
57  9488 return getId();
58    }
59   
 
60  18974 toggle @Override
61    public int hashCode()
62    {
63  18987 return new HashCodeBuilder(13, 7)
64    .append(getId())
65    .toHashCode();
66    }
67   
 
68  41833 toggle @Override
69    public boolean equals(Object object)
70    {
71  41920 if (object == null) {
72  0 return false;
73    }
74  41869 if (object == this) {
75  1717 return true;
76    }
77  40168 if (object.getClass() != getClass()) {
78  0 return false;
79    }
80  40164 ResourceType rhs = (ResourceType) object;
81  40177 return new EqualsBuilder()
82    .append(getId(), rhs.getId())
83    .isEquals();
84    }
85    }