1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.security.authorization.internal

File AbstractSecurityRuleEntry.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart6.png
72% of files have more coverage

Code metrics

4
8
3
1
64
33
5
0.62
2.67
3
1.67

Classes

Class Line # Actions
AbstractSecurityRuleEntry 33 8 0% 5 6
0.660%
 

Contributing tests

This file is covered by 32 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.security.authorization.internal;
21   
22    import org.apache.commons.lang3.builder.HashCodeBuilder;
23    import org.apache.commons.collections.CollectionUtils;
24    import org.xwiki.security.authorization.SecurityRuleEntry;
25   
26    /**
27    * This Abstract base class should be used for all SecurityRuleEntry implementing class to ensure
28    * proper implementation of equals and hashCode.
29    *
30    * @version $Id: 704052e7438079f7b9f6319d9ec68bc8fdf460b1 $
31    * @since 4.0M2
32    */
 
33    public abstract class AbstractSecurityRuleEntry implements SecurityRuleEntry
34    {
 
35  311 toggle @Override
36    public boolean equals(Object object)
37    {
38  311 if (object == this) {
39  0 return true;
40    }
41  311 if (!(object instanceof SecurityRuleEntry)) {
42  0 return false;
43    }
44  311 SecurityRuleEntry other = (SecurityRuleEntry) object;
45   
46  311 return this.getReference().equals(other.getReference())
47    && CollectionUtils.isEqualCollection(this.getRules(), other.getRules());
48    }
49   
 
50  0 toggle @Override
51    public int hashCode()
52    {
53  0 return new HashCodeBuilder()
54    .append(this.getReference())
55    .append(this.getRules())
56    .toHashCode();
57    }
58   
 
59  1585305 toggle @Override
60    public boolean isEmpty()
61    {
62  1585338 return this.getRules().isEmpty();
63    }
64    }