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 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
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.withConfig
(JsonbConfig config) Set configuration which will be set to the newly createdJsonb
instance.withProvider
(JsonProvider jsonpProvider)
-
Method Details
-
withConfig
-
withProvider
- 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
Create a newJsonb
instance using the defaultJsonbBuilder
implementation provided as returned fromJsonbProvider.provider()
method.- Returns:
- new
Jsonb
instance.
-
create
Create a newJsonb
instance using the defaultJsonbBuilder
implementation provided as returned fromJsonbProvider.provider()
method, configured with provided configuration. -
newBuilder
Create a newJsonbBuilder
instance as returned by the defaultJsonbProvider.provider()
method.- Returns:
- new
JsonbBuilder
instance.
-
newBuilder
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
Create a newJsonbBuilder
instance as returned byprovider#create
call.- Parameters:
provider
-JsonProvider
instance used for creatingJsonBuilder instances
.- Returns:
- new
JsonbBuilder
instance.
-