Skip to contentMethod: getProvider()
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.Optional;
16:
17: import jakarta.json.bind.Jsonb;
18: import jakarta.json.bind.JsonbBuilder;
19: import jakarta.json.bind.JsonbConfig;
20: import jakarta.json.spi.JsonProvider;
21:
22: /**
23: * JsonbBuilder implementation.
24: */
25: public class JsonBindingBuilder implements JsonbBuilder {
26: private JsonbConfig config = new JsonbConfig();
27: private JsonProvider provider = null;
28:
29: @Override
30: public JsonbBuilder withConfig(JsonbConfig config) {
31: this.config = config;
32: return this;
33: }
34:
35: @Override
36: public JsonbBuilder withProvider(JsonProvider jsonpProvider) {
37: this.provider = jsonpProvider;
38: return this;
39: }
40:
41: /**
42: * Gets configuration.
43: *
44: * @return configuration.
45: */
46: public JsonbConfig getConfig() {
47: return config;
48: }
49:
50: /**
51: * Gets provider.
52: *
53: * @return Provider.
54: */
55: public Optional<JsonProvider> getProvider() {
56: return Optional.ofNullable(provider);
57: }
58:
59: @Override
60: public Jsonb build() {
61: return new JsonBinding(this);
62: }
63: }