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

File LocalStringEntityReferenceSerializer.java

 

Coverage histogram

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

Code metrics

2
3
3
1
70
27
4
1.33
1
3
1.33

Classes

Class Line # Actions
LocalStringEntityReferenceSerializer 41 3 0% 4 0
1.0100%
 

Contributing tests

This file is covered by 331 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 javax.inject.Named;
23    import javax.inject.Singleton;
24   
25    import org.xwiki.component.annotation.Component;
26    import org.xwiki.model.EntityType;
27    import org.xwiki.model.reference.EntityReference;
28   
29    /**
30    * Generate a string representation of an entity reference but without the wiki reference name specified (eg
31    * "space.page" for a document reference). This is an implementation use for backward compatibility only and it should
32    * be dropped in the future since there's no reason to not output the wiki name systematically (usually we don't want to
33    * print it but only if it's the same as the current wiki).
34    *
35    * @version $Id: 175a9d4d618fb5df0d1c8333383b946e348ca7ea $
36    * @since 2.2M1
37    */
38    @Component
39    @Named("local")
40    @Singleton
 
41    public class LocalStringEntityReferenceSerializer extends DefaultStringEntityReferenceSerializer
42    {
43    /**
44    * Empty constructor, to be used by the Component Manager, which will also inject the Symbol Scheme.
45    */
 
46  430 toggle public LocalStringEntityReferenceSerializer()
47    {
48    // Empty constructor, to be used by the Component Manager, which will also inject the Symbol Scheme
49    }
50   
51    /**
52    * Constructor to be used when using this class as a POJO and not as a component.
53    *
54    * @param symbolScheme the scheme to use for serializing the passed references (i.e. defines the separators to use
55    * between the Entity types, and the characters to escape and how to escape them)
56    */
 
57  121 toggle public LocalStringEntityReferenceSerializer(SymbolScheme symbolScheme)
58    {
59  121 super(symbolScheme);
60    }
61   
 
62  996707 toggle @Override
63    protected void serializeEntityReference(EntityReference currentReference, StringBuilder representation,
64    boolean isLastReference, Object... parameters)
65    {
66  996691 if (currentReference.getType() != EntityType.WIKI) {
67  630311 super.serializeEntityReference(currentReference, representation, isLastReference, parameters);
68    }
69    }
70    }