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

File DefaultTranslationMessage.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
8
4
1
84
39
4
0.5
2
4
1

Classes

Class Line # Actions
DefaultTranslationMessage 39 8 0% 4 12
0.00%
 

Contributing tests

No tests hitting this source file were found.

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.localization.internal.message;
21   
22    import java.util.ArrayList;
23    import java.util.Collection;
24    import java.util.List;
25    import java.util.Locale;
26   
27    import org.xwiki.localization.TranslationBundle;
28    import org.xwiki.localization.message.TranslationMessage;
29    import org.xwiki.localization.message.TranslationMessageElement;
30    import org.xwiki.rendering.block.Block;
31    import org.xwiki.rendering.block.CompositeBlock;
32   
33    /**
34    * Default implementation of {@link TranslationMessage}.
35    *
36    * @version $Id: 3f6def03d112002da9e5428bf6c1cc52f133c07c $
37    * @since 4.3M2
38    */
 
39    public class DefaultTranslationMessage implements TranslationMessage
40    {
41    /**
42    * The source of the translation message.
43    */
44    private String rawSource;
45   
46    /**
47    * The elements in the message.
48    */
49    private List<TranslationMessageElement> elements;
50   
51    /**
52    * @param rawSource the source of the translation message
53    * @param elements the elements in the message
54    */
 
55  0 toggle public DefaultTranslationMessage(String rawSource, List<TranslationMessageElement> elements)
56    {
57  0 this.rawSource = rawSource;
58  0 this.elements = new ArrayList<TranslationMessageElement>(elements);
59    }
60   
 
61  0 toggle @Override
62    public Block render(Locale locale, Collection<TranslationBundle> bundles, Object... parameters)
63    {
64  0 Block block = new CompositeBlock();
65   
66  0 for (TranslationMessageElement element : this.elements) {
67  0 block.addChild(element.render(locale, bundles, parameters));
68    }
69   
70  0 return null;
71    }
72   
 
73  0 toggle @Override
74    public String getRawSource()
75    {
76  0 return this.rawSource;
77    }
78   
 
79  0 toggle @Override
80    public String toString()
81    {
82  0 return getRawSource();
83    }
84    }