Skip to content

Package: SerializerBinding

SerializerBinding

nameinstructionbranchcomplexitylinemethod
SerializerBinding(Type, JsonbSerializer)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getComponentClass()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getJsonbSerializer()
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) 2016, 2020 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.components;
14:
15: import java.lang.reflect.Type;
16:
17: import jakarta.json.bind.serializer.JsonbSerializer;
18:
19: /**
20: * Binding for user Serializer component.
21: *
22: * @param <T> type of jsonb serializer
23: */
24: public class SerializerBinding<T> extends AbstractComponentBinding {
25:
26: private final JsonbSerializer<T> jsonbSerializer;
27:
28: /**
29: * Creates a new instance.
30: *
31: * @param bindingType Generic type argument of serializer. Not null.
32: * @param jsonbSerializer Serializer. Can be null.
33: */
34: public SerializerBinding(Type bindingType, JsonbSerializer<T> jsonbSerializer) {
35: super(bindingType);
36: this.jsonbSerializer = jsonbSerializer;
37: }
38:
39: /**
40: * Returns a serializer if any.
41: *
42: * @return Serializer.
43: */
44: public JsonbSerializer<T> getJsonbSerializer() {
45: return jsonbSerializer;
46: }
47:
48: /**
49: * Class of user component.
50: *
51: * @return Component class.
52: */
53: @Override
54: public Class<?> getComponentClass() {
55: return jsonbSerializer.getClass();
56: }
57: }