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

File DocumentSkinReference.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart4.png
78% of files have more coverage

Code metrics

2
10
6
1
82
40
7
0.7
1.67
6
1.17

Classes

Class Line # Actions
DocumentSkinReference 31 10 0% 7 11
0.388888938.9%
 

Contributing tests

This file is covered by 3 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.skin;
21   
22    import org.xwiki.model.reference.DocumentReference;
23    import org.xwiki.model.reference.EntityReferenceSerializer;
24   
25    /**
26    * A specialized implementation of {@link SkinReference} for any skin stored as a document in the wiki.
27    *
28    * @since 6.4M2
29    * @version $Id: e235e6f6ab963a0db6f662ede95b15d121d62d66 $
30    */
 
31    public class DocumentSkinReference implements SkinReference
32    {
33    private DocumentReference skinDocument;
34   
35    private EntityReferenceSerializer<String> entityReferenceSerializer;
36   
37    /**
38    * Construct a new document skin reference.
39    * @param skinDocument reference to the skin document
40    * @param entityReferenceSerializer document serializer
41    */
 
42  3 toggle public DocumentSkinReference(DocumentReference skinDocument,
43    EntityReferenceSerializer<String> entityReferenceSerializer)
44    {
45  3 this.skinDocument = skinDocument;
46  3 this.entityReferenceSerializer = entityReferenceSerializer;
47    }
48   
49    /**
50    * @return the skin document
51    */
 
52  1 toggle public DocumentReference getSkinDocument()
53    {
54  1 return skinDocument;
55    }
56   
 
57  0 toggle @Override
58    public boolean equals(Object o) {
59  0 if (o instanceof DocumentSkinReference) {
60  0 DocumentSkinReference documentSkinReference = (DocumentSkinReference) o;
61  0 return skinDocument.equals(documentSkinReference.skinDocument);
62    }
63  0 return false;
64    }
65   
 
66  0 toggle @Override
67    public int hashCode() {
68  0 return skinDocument.hashCode();
69    }
70   
 
71  1 toggle @Override
72    public String serialize()
73    {
74  1 return String.format("SkinDocument[%s]", entityReferenceSerializer.serialize(skinDocument));
75    }
76   
 
77  0 toggle @Override
78    public String toString()
79    {
80  0 return serialize();
81    }
82    }