| 1 | package fr.sii.ogham.core.template.context; | |
| 2 | ||
| 3 | import java.util.Locale; | |
| 4 | import java.util.Map; | |
| 5 | ||
| 6 | import fr.sii.ogham.core.exception.template.ContextException; | |
| 7 | ||
| 8 | /** | |
| 9 | * A context that also provides {@link Locale} information for | |
| 10 | * internationalization. It allows to explicitly specify the language. | |
| 11 | * | |
| 12 | * @author Aurélien Baudet | |
| 13 | * | |
| 14 | */ | |
| 15 | public class LocaleContext implements Context { | |
| 16 | /** | |
| 17 | * The context that contains the variables | |
| 18 | */ | |
| 19 | private final Context delegate; | |
| 20 | | |
| 21 | /** | |
| 22 | * The locale to use | |
| 23 | */ | |
| 24 | private final Locale locale; | |
| 25 | ||
| 26 | public LocaleContext(Context delegate, Locale locale) { | |
| 27 | super(); | |
| 28 | this.delegate = delegate; | |
| 29 | this.locale = locale; | |
| 30 | } | |
| 31 | ||
| 32 | public LocaleContext(Object bean, Locale locale) { | |
| 33 | this(new BeanContext(bean), locale); | |
| 34 | } | |
| 35 | ||
| 36 | @Override | |
| 37 | public Map<String, Object> getVariables() throws ContextException { | |
| 38 |
4
1. getVariables : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getVariables → NO_COVERAGE 2. getVariables : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getVariables → KILLED 3. getVariables : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getVariables → KILLED 4. getVariables : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getVariables → KILLED |
return delegate.getVariables(); |
| 39 | } | |
| 40 | ||
| 41 | public Locale getLocale() { | |
| 42 |
4
1. getLocale : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getLocale → NO_COVERAGE 2. getLocale : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getLocale → KILLED 3. getLocale : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getLocale → KILLED 4. getLocale : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getLocale → KILLED |
return locale; |
| 43 | } | |
| 44 | ||
| 45 | public Context getDelegate() { | |
| 46 |
1
1. getDelegate : replaced return value with null for fr/sii/ogham/core/template/context/LocaleContext::getDelegate → NO_COVERAGE |
return delegate; |
| 47 | } | |
| 48 | } | |
Mutations | ||
| 38 |
1.1 2.2 3.3 4.4 |
|
| 42 |
1.1 2.2 3.3 4.4 |
|
| 46 |
1.1 |