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

File ExtensionLicense.java

 

Coverage histogram

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

Code metrics

6
12
6
1
97
43
9
0.75
2
6
1.5

Classes

Class Line # Actions
ExtensionLicense 32 12 0% 9 10
0.583333358.3%
 

Contributing tests

This file is covered by 8 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.util.List;
23   
24    import org.apache.commons.lang3.StringUtils;
25   
26    /**
27    * License of an extension.
28    *
29    * @version $Id: ed03e5da38bc258a0f1d77b2a00c6d6fd351e110 $
30    * @since 4.0M1
31    */
 
32    public class ExtensionLicense
33    {
34    /**
35    * @see #getName()
36    */
37    private String name;
38   
39    /**
40    * @see #getContent()
41    */
42    private List<String> content;
43   
44    /**
45    * @param name the name of the license
46    * @param content the content of the license
47    */
 
48  13292 toggle public ExtensionLicense(String name, List<String> content)
49    {
50  13292 this.name = name;
51  13292 this.content = content;
52    }
53   
54    /**
55    * @return the name of the license
56    */
 
57  29409 toggle public String getName()
58    {
59  29409 return this.name;
60    }
61   
62    /**
63    * @return the content of the license
64    */
 
65  2698 toggle public List<String> getContent()
66    {
67  2698 return this.content;
68    }
69   
 
70  0 toggle @Override
71    public String toString()
72    {
73  0 return getName();
74    }
75   
 
76  1 toggle @Override
77    public boolean equals(Object obj)
78    {
79  1 if (obj == this) {
80  0 return true;
81    }
82   
83  1 if (obj instanceof ExtensionLicense) {
84  1 ExtensionLicense license = (ExtensionLicense) obj;
85    // No need to take care of the content, if it's the same name, it's the same license
86  1 return StringUtils.equals(getName(), license.getName());
87    }
88   
89  0 return false;
90    }
91   
 
92  0 toggle @Override
93    public int hashCode()
94    {
95  0 return getName() != null ? getName().hashCode() : super.hashCode();
96    }
97    }