Skip to content

Package: JsonbNumberFormatter

JsonbNumberFormatter

nameinstructionbranchcomplexitylinemethod
JsonbNumberFormatter(String, String)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
equals(Object)
M: 33 C: 0
0%
M: 10 C: 0
0%
M: 6 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
getFormat()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getLocale()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
hashCode()
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
toString()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0 which is available at
6: * http://www.eclipse.org/legal/epl-2.0,
7: * or the Eclipse Distribution License v. 1.0 which is available at
8: * http://www.eclipse.org/org/documents/edl-v10.php.
9: *
10: * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
11: */
12:
13: package org.eclipse.yasson.internal;
14:
15: import java.util.Objects;
16:
17: /**
18: * Formatter for numbers.
19: */
20: public class JsonbNumberFormatter {
21:
22: private final String format;
23:
24: private final String locale;
25:
26: /**
27: * Construct with format string and locale.
28: *
29: * @param format formatter format
30: * @param locale locale
31: */
32: public JsonbNumberFormatter(String format, String locale) {
33: this.format = format;
34: this.locale = locale;
35: }
36:
37: /**
38: * Format string to be used either by formatter.
39: *
40: * @return format
41: */
42: public String getFormat() {
43: return format;
44: }
45:
46: /**
47: * Locale to use with formatter.
48: *
49: * @return locale
50: */
51: public String getLocale() {
52: return locale;
53: }
54:
55: @Override
56: public boolean equals(Object o) {
57:• if (this == o) {
58: return true;
59: }
60:• if (o == null || getClass() != o.getClass()) {
61: return false;
62: }
63: JsonbNumberFormatter that = (JsonbNumberFormatter) o;
64:• return Objects.equals(format, that.format)
65:• && Objects.equals(locale, that.locale);
66: }
67:
68: @Override
69: public int hashCode() {
70: return Objects.hash(format, locale);
71: }
72:
73: @Override
74: public String toString() {
75: return "JsonbNumberFormatter{"
76: + "format='" + format + '\''
77: + ", locale='" + locale + '\''
78: + '}';
79: }
80: }