Package: Bundle

Bundle

nameinstructionbranchcomplexitylinemethod
Bundle()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
bundleName()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getBundle()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getMessage(Locale, String, Object[])
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getMessage(String)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getMessage(String, Object[])
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
retry(Locale, String)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: package jmri.jmrit.blockboss;
2:
3: import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
4: import java.util.Locale;
5: import javax.annotation.CheckReturnValue;
6: import javax.annotation.CheckForNull;
7: import javax.annotation.ParametersAreNonnullByDefault;
8:
9: @ParametersAreNonnullByDefault
10: @CheckReturnValue
11: @SuppressFBWarnings(value = "NM_SAME_SIMPLE_NAME_AS_SUPERCLASS", justification = "Desired pattern is repeated class names with package-level access to members")
12:
13: @javax.annotation.concurrent.Immutable
14:
15: /**
16: * Provides standard access for resource bundles in a package.
17: *
18: * Convention is to provide a subclass of this name in each package, working off
19: * the local resource bundle name.
20: *
21: * @author Bob Jacobsen Copyright (C) 2012
22: * @since 3.3.1
23: */
24: public class Bundle extends jmri.jmrit.Bundle {
25:
26: @CheckForNull
27: private static final String name = "jmri.jmrit.blockboss.BlockBossBundle"; // NOI18N
28:
29: //
30: // below here is boilerplate to be copied exactly
31: //
32: /**
33: * Provides a translated string for a given key from the package resource
34: * bundle or parent.
35: * <p>
36: * Note that this is intentionally package-local access.
37: *
38: * @param key Bundle key to be translated
39: * @return Internationalized text
40: */
41: static String getMessage(String key) {
42: return getBundle().handleGetMessage(key);
43: }
44:
45: /**
46: * Merges user data with a translated string for a given key from the
47: * package resource bundle or parent.
48: * <p>
49: * Uses the transformation conventions of the Java MessageFormat utility.
50: * <p>
51: * Note that this is intentionally package-local access.
52: *
53: * @see java.text.MessageFormat
54: * @param key Bundle key to be translated
55: * @param subs One or more objects to be inserted into the message
56: * @return Internationalized text
57: */
58: static String getMessage(String key, Object... subs) {
59: return getBundle().handleGetMessage(key, subs);
60: }
61:
62: /**
63: * Merges user data with a translated string for a given key in a given
64: * locale from the package resource bundle or parent.
65: * <p>
66: * Uses the transformation conventions of the Java MessageFormat utility.
67: * <p>
68: * Note that this is intentionally package-local access.
69: *
70: * @see java.text.MessageFormat
71: * @param locale The locale to be used
72: * @param key Bundle key to be translated
73: * @param subs One or more objects to be inserted into the message
74: * @return Internationalized text
75: */
76: static String getMessage(Locale locale, String key, Object... subs) {
77: return getBundle().handleGetMessage(locale, key, subs);
78: }
79:
80: private final static Bundle b = new Bundle();
81:
82: @Override
83: @CheckForNull
84: protected String bundleName() {
85: return name;
86: }
87:
88: protected static jmri.Bundle getBundle() {
89: return b;
90: }
91:
92: @Override
93: protected String retry(Locale locale, String key) {
94: return super.getBundle().handleGetMessage(locale,key);
95: }
96:
97: }
98: