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

File DefaultExtensionAuthor.java

 

Coverage histogram

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

Code metrics

4
14
5
1
95
46
7
0.5
2.8
5
1.4

Classes

Class Line # Actions
DefaultExtensionAuthor 34 14 0% 7 4
0.8260869482.6%
 

Contributing tests

This file is covered by 12 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.extension;
21   
22    import java.net.URL;
23    import java.util.Objects;
24   
25    import org.apache.commons.lang3.StringUtils;
26    import org.apache.commons.lang3.builder.HashCodeBuilder;
27   
28    /**
29    * Default implementation of ExtensionAuthor.
30    *
31    * @version $Id: c1c2d9d6ad7c02e663f87549f8e196b8cac5c705 $
32    * @since 4.0M1
33    */
 
34    public class DefaultExtensionAuthor implements ExtensionAuthor
35    {
36    /**
37    * @see #getName()
38    */
39    private String name;
40   
41    /**
42    * @see #getURL()
43    */
44    private URL url;
45   
46    /**
47    * @param name the name of the author
48    * @param url the URL of the author public profile
49    */
 
50  101717 toggle public DefaultExtensionAuthor(String name, URL url)
51    {
52  101717 this.name = name;
53  101717 this.url = url;
54    }
55   
 
56  114775 toggle @Override
57    public String getName()
58    {
59  114775 return this.name;
60    }
61   
 
62  112452 toggle @Override
63    public URL getURL()
64    {
65  112452 return this.url;
66    }
67   
68    // Object
69   
 
70  65274 toggle @Override
71    public boolean equals(Object obj)
72    {
73  65274 if (obj == this) {
74  0 return true;
75    }
76   
77  65274 if (obj instanceof ExtensionAuthor) {
78  65274 ExtensionAuthor author = (ExtensionAuthor) obj;
79  65274 return StringUtils.equals(this.name, author.getName()) && Objects.equals(this.url, author.getURL());
80    } else {
81  0 return false;
82    }
83    }
84   
 
85  138419 toggle @Override
86    public int hashCode()
87    {
88  138419 HashCodeBuilder builder = new HashCodeBuilder();
89   
90  138419 builder.append(this.url);
91  138419 builder.append(this.name);
92   
93  138419 return builder.toHashCode();
94    }
95    }