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

File AbstractStringEntityReferenceSerializer.java

 
 

Coverage histogram

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

Code metrics

2
6
1
1
60
20
2
0.33
6
1
2

Classes

Class Line # Actions
AbstractStringEntityReferenceSerializer 32 6 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 2874 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   
21    package org.xwiki.model.internal.reference;
22   
23    import org.xwiki.model.reference.EntityReference;
24    import org.xwiki.model.reference.EntityReferenceSerializer;
25   
26    /**
27    * Generic implementation deferring single reference serialization.
28    *
29    * @version $Id: 027d4b5866ce62e1c0b4d6ed07c3b74f06632e01 $
30    * @since 3.3M2
31    */
 
32    public abstract class AbstractStringEntityReferenceSerializer implements EntityReferenceSerializer<String>
33    {
 
34  2217591 toggle @Override
35    public String serialize(EntityReference reference, Object... parameters)
36    {
37  2217578 if (reference == null) {
38  8867 return null;
39    }
40   
41  2208711 StringBuilder representation = new StringBuilder();
42   
43  2208624 for (EntityReference currentReference : reference.getReversedReferenceChain()) {
44  6323037 Test failure here serializeEntityReference(currentReference, representation, currentReference == reference, parameters);
45    }
46   
47  2208839 return representation.toString();
48    }
49   
50    /**
51    * Serialize a single reference element into the representation string builder.
52    *
53    * @param currentReference the reference to serialize
54    * @param representation the builder where to write the serialized member to (this is an output parameter)
55    * @param isLastReference indicate if it's the last member of the reference
56    * @param parameters optional parameters
57    */
58    protected abstract void serializeEntityReference(EntityReference currentReference, StringBuilder representation,
59    boolean isLastReference, Object... parameters);
60    }