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

File NamedColorThemeReference.java

 

Coverage histogram

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

Code metrics

2
8
5
1
67
31
6
0.75
1.6
5
1.2

Classes

Class Line # Actions
NamedColorThemeReference 29 8 0% 6 4
0.7333333573.3%
 

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.lesscss.internal.colortheme;
21   
22    /**
23    * Specialized implementation of {@link org.xwiki.lesscss.internal.colortheme.ColorThemeReference} for color themes that
24    * are not stored in the wiki (currently, it concerns the "default" color theme only).
25    *
26    * @since 6.4M2
27    * @version $Id: 428912c53ffee22b374f623b65c22e8a3dabb1b5 $
28    */
 
29    public class NamedColorThemeReference implements ColorThemeReference
30    {
31    private String colorThemeName;
32   
33    /**
34    * Construct a new reference to a color theme that is not stored in the wiki.
35    * @param colorThemeName name of the color theme
36    */
 
37  2187 toggle public NamedColorThemeReference(String colorThemeName)
38    {
39  2187 this.colorThemeName = colorThemeName;
40    }
41   
 
42  36 toggle @Override
43    public boolean equals(Object o) {
44  36 if (o instanceof NamedColorThemeReference) {
45  36 NamedColorThemeReference namedColorThemeReference = (NamedColorThemeReference) o;
46  36 return colorThemeName.equals(namedColorThemeReference.colorThemeName);
47    }
48  0 return false;
49    }
50   
 
51  149 toggle @Override
52    public int hashCode() {
53  149 return colorThemeName.hashCode();
54    }
55   
 
56  4343 toggle @Override
57    public String serialize()
58    {
59  4343 return String.format("ColorThemeFS[%s]", colorThemeName);
60    }
61   
 
62  0 toggle @Override
63    public String toString()
64    {
65  0 return serialize();
66    }
67    }