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

File DocumentColorThemeReference.java

 

Coverage histogram

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

Code metrics

2
9
5
1
75
36
6
0.67
1.8
5
1.2

Classes

Class Line # Actions
DocumentColorThemeReference 32 9 0% 6 4
0.7575%
 

Contributing tests

This file is covered by 4 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    import org.xwiki.model.reference.DocumentReference;
23    import org.xwiki.model.reference.EntityReferenceSerializer;
24   
25    /**
26    * Specialized implementation of {@link org.xwiki.lesscss.internal.colortheme.ColorThemeReference} for color theme stored as a
27    * document in the wiki.
28    *
29    * @since 6.4M2
30    * @version $Id: 92214949d465bf7ff9548f7da33a56061763a8e9 $
31    */
 
32    public class DocumentColorThemeReference implements ColorThemeReference
33    {
34    private DocumentReference colorThemeDocument;
35   
36    private EntityReferenceSerializer<String> entityReferenceSerializer;
37   
38    /**
39    * Construct a new reference.
40    * @param colorThemeDocument reference to the color theme document
41    * @param entityReferenceSerializer document reference serializer
42    */
 
43  36 toggle public DocumentColorThemeReference(DocumentReference colorThemeDocument,
44    EntityReferenceSerializer<String> entityReferenceSerializer)
45    {
46  36 this.colorThemeDocument = colorThemeDocument;
47  36 this.entityReferenceSerializer = entityReferenceSerializer;
48    }
49   
 
50  2 toggle @Override
51    public boolean equals(Object o) {
52  2 if (o instanceof DocumentColorThemeReference) {
53  2 DocumentColorThemeReference documentSkinReference = (DocumentColorThemeReference) o;
54  2 return colorThemeDocument.equals(documentSkinReference.colorThemeDocument);
55    }
56  0 return false;
57    }
58   
 
59  20 toggle @Override
60    public int hashCode() {
61  20 return colorThemeDocument.hashCode();
62    }
63   
 
64  52 toggle @Override
65    public String serialize()
66    {
67  52 return String.format("ColorThemeDocument[%s]", entityReferenceSerializer.serialize(colorThemeDocument));
68    }
69   
 
70  0 toggle @Override
71    public String toString()
72    {
73  0 return serialize();
74    }
75    }