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

File LocalizedStringEntityReferenceSerializer.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

8
10
2
1
63
28
6
0.6
5
2
3

Classes

Class Line # Actions
LocalizedStringEntityReferenceSerializer 33 10 0% 6 1
0.9595%
 

Contributing tests

This file is covered by 2590 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.model.internal.reference;
21   
22    import org.xwiki.model.reference.DocumentReference;
23    import org.xwiki.model.reference.EntityReference;
24    import org.xwiki.model.reference.LocalDocumentReference;
25   
26    /**
27    * Extends {@link DefaultStringEntityReferenceSerializer} to add the serialization of the Locale for Document
28    * References.
29    *
30    * @version $Id: 7e48883f95f5b50b2228be9d04838493fa62cc43 $
31    * @since 4.2M3
32    */
 
33    public class LocalizedStringEntityReferenceSerializer extends DefaultStringEntityReferenceSerializer
34    {
35    /**
36    * @param symbolScheme the scheme to use for serializing the passed references (i.e. defines the separators to use
37    * between the Entity types, and the characters to escape and how to escape them)
38    */
 
39  139 toggle public LocalizedStringEntityReferenceSerializer(SymbolScheme symbolScheme)
40    {
41  139 super(symbolScheme);
42    }
43   
 
44  1315707 toggle @Override
45    protected void serializeEntityReference(EntityReference currentReference, StringBuilder representation,
46    boolean isLastReference, Object... parameters)
47    {
48  1315697 super.serializeEntityReference(currentReference, representation, isLastReference, parameters);
49   
50    // Append parameters for DocumentReference (if any)
51  1315780 if (currentReference instanceof DocumentReference) {
52  424021 DocumentReference documentReference = (DocumentReference) currentReference;
53  424019 if (documentReference.getLocale() != null) {
54  14119 representation.append('(').append(documentReference.getLocale()).append(')');
55    }
56  891747 } else if (currentReference instanceof LocalDocumentReference) {
57  2 LocalDocumentReference documentReference = (LocalDocumentReference) currentReference;
58  2 if (documentReference.getLocale() != null) {
59  2 representation.append('(').append(documentReference.getLocale()).append(')');
60    }
61    }
62    }
63    }