Skip to content

Package: TranslatorNotFoundException

TranslatorNotFoundException

nameinstructionbranchcomplexitylinemethod
TranslatorNotFoundException(Class, Class)
M: 20 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getFromMessageClass()
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%
getToMessageClass()
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.translator.exception;
14:
15: /**
16: * {@link TranslatorRuntimeException} to {@code throw} when no {@link org.eclipse.kapua.translator.Translator} are available for the given {@link org.eclipse.kapua.message.Message} classes.
17: *
18: * @since 1.2.0
19: */
20: public class TranslatorNotFoundException extends TranslatorRuntimeException {
21:
22: private final Class<?> fromMessageClass;
23: private final Class<?> toMessageClass;
24:
25: /**
26: * Constructor.
27: *
28: * @param fromMessageClass The {@link org.eclipse.kapua.message.Message} type for which the {@link org.eclipse.kapua.translator.Translator} was from.
29: * @param toMessageClass The {@link org.eclipse.kapua.message.Message} type for which the {@link org.eclipse.kapua.translator.Translator} was to.
30: * @since 1.2.0
31: */
32: public TranslatorNotFoundException(Class<?> fromMessageClass, Class<?> toMessageClass) {
33: super(TranslatorErrorCodes.TRANSLATOR_NOT_FOUND, fromMessageClass, toMessageClass);
34:
35: this.fromMessageClass = fromMessageClass;
36: this.toMessageClass = toMessageClass;
37: }
38:
39: /**
40: * Gets the {@link org.eclipse.kapua.message.Message} type for which the {@link org.eclipse.kapua.translator.Translator} was from.
41: *
42: * @return The {@link org.eclipse.kapua.message.Message} type for which the {@link org.eclipse.kapua.translator.Translator} was from.
43: * @since 1.2.0
44: */
45: public Class<?> getFromMessageClass() {
46: return fromMessageClass;
47: }
48:
49: /**
50: * Gets the {@link org.eclipse.kapua.message.Message} type for which the {@link org.eclipse.kapua.translator.Translator} was to.
51: *
52: * @return The {@link org.eclipse.kapua.message.Message} type for which the {@link org.eclipse.kapua.translator.Translator} was to.
53: * @since 1.2.0
54: */
55: public Class<?> getToMessageClass() {
56: return toMessageClass;
57: }
58: }