Skip to content

Package: UnsupportedTypeMappingException

UnsupportedTypeMappingException

nameinstructionbranchcomplexitylinemethod
UnsupportedTypeMappingException(String, Object)
M: 38 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getName()
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%
getType()
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%
getValue()
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%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2020, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.service.storable.exception;
14:
15: /**
16: * {@link MappingException} to {@code throw} when the value given to be serialized cannot be mapped to any type.
17: *
18: * @since 1.3.0
19: */
20: public class UnsupportedTypeMappingException extends MappingException {
21:
22: private final String name;
23: private final Object value;
24: private final Class<?> type;
25:
26: /**
27: * Constructor.
28: *
29: * @param value The value for which mapping is not supported by the code.
30: * @since 1.3.0
31: */
32: public UnsupportedTypeMappingException(String name, Object value) {
33:• super(StorableErrorCodes.UNSUPPORTED_TYPE, name, value, value != null ? value.getClass().getName() : "null");
34:
35: this.name = name;
36: this.value = value;
37:• this.type = value != null ? value.getClass() : null;
38: }
39:
40: /**
41: * Gets the name of the mappable value.
42: *
43: * @return The name of the mappable value.
44: * @since 1.3.0
45: */
46: public String getName() {
47: return name;
48: }
49:
50: /**
51: * Gets the not mappable value.
52: *
53: * @return The not mappable value.
54: * @since 1.3.0
55: */
56: public Object getValue() {
57: return value;
58: }
59:
60: /**
61: * Gets the not mappable {@link Class}.
62: *
63: * @return he not mappable {@link Class}.
64: * @since 1.3.0
65: */
66: public Class<?> getType() {
67: return type;
68: }
69: }