-
public interface JsonbBuilder
JsonbBuilder class provides the client's entry point to the JSON Binding API. It buildsJsonb
instances 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 Jsonb
build()
Returns a new instance ofJsonb
based on the parameters and configuration specified previously in this builder.static Jsonb
create()
Create a newJsonb
instance using the defaultJsonbBuilder
implementation provided as returned fromJsonbProvider.provider()
method.static Jsonb
create(JsonbConfig config)
Create a newJsonb
instance using the defaultJsonbBuilder
implementation provided as returned fromJsonbProvider.provider()
method, configured with provided configuration.static JsonbBuilder
newBuilder()
Create a newJsonbBuilder
instance as returned by the defaultJsonbProvider.provider()
method.static JsonbBuilder
newBuilder(JsonbProvider provider)
Create a newJsonbBuilder
instance as returned byprovider#create
call.static JsonbBuilder
newBuilder(String providerName)
Create a newJsonbBuilder
instance as returned byJsonbProvider.provider(String)
method.JsonbBuilder
withConfig(JsonbConfig config)
Set configuration which will be set to the newly createdJsonb
instance.JsonbBuilder
withProvider(jakarta.json.spi.JsonProvider jsonpProvider)
-
-
-
Method Detail
-
withConfig
JsonbBuilder withConfig(JsonbConfig config)
Set configuration which will be set to the newly createdJsonb
instance.- Parameters:
config
- Configuration forJsonb
instance.- Returns:
- This
JsonbBuilder
instance.
-
withProvider
JsonbBuilder withProvider(jakarta.json.spi.JsonProvider jsonpProvider)
- Parameters:
jsonpProvider
-JsonProvider
instance to be used by Jsonb to lookup JSON-P implementation.- Returns:
- This
JsonbBuilder
instance.
-
build
Jsonb build()
Returns a new instance ofJsonb
based on the parameters and configuration specified previously in this builder.- Returns:
- Jsonb A new instance of
Jsonb
class. 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 newJsonb
instance using the defaultJsonbBuilder
implementation provided as returned fromJsonbProvider.provider()
method.- Returns:
- new
Jsonb
instance.
-
create
static Jsonb create(JsonbConfig config)
Create a newJsonb
instance using the defaultJsonbBuilder
implementation provided as returned fromJsonbProvider.provider()
method, configured with provided configuration.
-
newBuilder
static JsonbBuilder newBuilder()
Create a newJsonbBuilder
instance as returned by the defaultJsonbProvider.provider()
method.- Returns:
- new
JsonbBuilder
instance.
-
newBuilder
static JsonbBuilder newBuilder(String providerName)
Create a newJsonbBuilder
instance as returned byJsonbProvider.provider(String)
method.- Parameters:
providerName
- Provider class name to be looked up byServiceLoader
.- Returns:
- new
JsonbBuilder
instance.
-
newBuilder
static JsonbBuilder newBuilder(JsonbProvider provider)
Create a newJsonbBuilder
instance as returned byprovider#create
call.- Parameters:
provider
-JsonProvider
instance used for creatingJsonBuilder instances
.- Returns:
- new
JsonbBuilder
instance.
-
-