Package jakarta.json.bind
Interface JsonbBuilder
public interface JsonbBuilder
JsonbBuilder class provides the client's entry point to the JSON Binding
API. It builds
Jsonb instances based on all
parameters and configuration provided before calling build() method.
For most use-cases, only one instance of JsonbBuilder is required within the
application.- Since:
- JSON Binding 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a new instance ofJsonbbased on the parameters and configuration specified previously in this builder.static Jsonbcreate()Create a newJsonbinstance using the defaultJsonbBuilderimplementation provided as returned fromJsonbProvider.provider()method.static Jsonbcreate(JsonbConfig config) Create a newJsonbinstance using the defaultJsonbBuilderimplementation provided as returned fromJsonbProvider.provider()method, configured with provided configuration.static JsonbBuilderCreate a newJsonbBuilderinstance as returned by the defaultJsonbProvider.provider()method.static JsonbBuildernewBuilder(JsonbProvider provider) Create a newJsonbBuilderinstance as returned byprovider#createcall.static JsonbBuildernewBuilder(String providerName) Create a newJsonbBuilderinstance as returned byJsonbProvider.provider(String)method.withConfig(JsonbConfig config) Set configuration which will be set to the newly createdJsonbinstance.withProvider(JsonProvider jsonpProvider)
-
Method Details
-
withConfig
Set configuration which will be set to the newly createdJsonbinstance.- Parameters:
config- Configuration forJsonbinstance.- Returns:
- This
JsonbBuilderinstance.
-
withProvider
- Parameters:
jsonpProvider-JsonProviderinstance to be used by Jsonb to lookup JSON-P implementation.- Returns:
- This
JsonbBuilderinstance.
-
build
Jsonb build()Returns a new instance ofJsonbbased on the parameters and configuration specified previously in this builder.- Returns:
- Jsonb A new instance of
Jsonbclass. Always a non-null valid object. - Throws:
JsonbException- If an error was encountered while creating the Jsonb instance, such as (but not limited to) no JSON Binding provider found, or classes provide conflicting annotations.IllegalArgumentException- If there's an error processing the set parameters, such as the non-null parameter is assigned null value, or unrecognized property is set inJsonbConfig.
-
create
Create a newJsonbinstance using the defaultJsonbBuilderimplementation provided as returned fromJsonbProvider.provider()method.- Returns:
- new
Jsonbinstance.
-
create
Create a newJsonbinstance using the defaultJsonbBuilderimplementation provided as returned fromJsonbProvider.provider()method, configured with provided configuration. -
newBuilder
Create a newJsonbBuilderinstance as returned by the defaultJsonbProvider.provider()method.- Returns:
- new
JsonbBuilderinstance.
-
newBuilder
Create a newJsonbBuilderinstance as returned byJsonbProvider.provider(String)method.- Parameters:
providerName- Provider class name to be looked up byServiceLoader.- Returns:
- new
JsonbBuilderinstance.
-
newBuilder
Create a newJsonbBuilderinstance as returned byprovider#createcall.- Parameters:
provider-JsonProviderinstance used for creatingJsonBuilder instances.- Returns:
- new
JsonbBuilderinstance.
-