Package jakarta.json.bind
Interface JsonbBuilder
-
public interface JsonbBuilderJsonbBuilder class provides the client's entry point to the JSON Binding API. It buildsJsonbinstances based on all parameters and configuration provided before callingbuild()method. For most use-cases, only one instance of JsonbBuilder is required within the application.- Since:
- JSON Binding 1.0
- See Also:
Jsonb,ServiceLoader
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Jsonbbuild()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 JsonbBuildernewBuilder()Create 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.JsonbBuilderwithConfig(JsonbConfig config)Set configuration which will be set to the newly createdJsonbinstance.JsonbBuilderwithProvider(JsonProvider jsonpProvider)
-
-
-
Method Detail
-
withConfig
JsonbBuilder withConfig(JsonbConfig config)
Set configuration which will be set to the newly createdJsonbinstance.- Parameters:
config- Configuration forJsonbinstance.- Returns:
- This
JsonbBuilderinstance.
-
withProvider
JsonbBuilder withProvider(JsonProvider jsonpProvider)
- 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
static Jsonb create()
Create a newJsonbinstance using the defaultJsonbBuilderimplementation provided as returned fromJsonbProvider.provider()method.- Returns:
- new
Jsonbinstance.
-
create
static Jsonb create(JsonbConfig config)
Create a newJsonbinstance using the defaultJsonbBuilderimplementation provided as returned fromJsonbProvider.provider()method, configured with provided configuration.
-
newBuilder
static JsonbBuilder newBuilder()
Create a newJsonbBuilderinstance as returned by the defaultJsonbProvider.provider()method.- Returns:
- new
JsonbBuilderinstance.
-
newBuilder
static JsonbBuilder newBuilder(String providerName)
Create a newJsonbBuilderinstance as returned byJsonbProvider.provider(String)method.- Parameters:
providerName- Provider class name to be looked up byServiceLoader.- Returns:
- new
JsonbBuilderinstance.
-
newBuilder
static JsonbBuilder newBuilder(JsonbProvider provider)
Create a newJsonbBuilderinstance as returned byprovider#createcall.- Parameters:
provider-JsonProviderinstance used for creatingJsonBuilder instances.- Returns:
- new
JsonbBuilderinstance.
-
-