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.
    JSON Binding 1.0
    See Also:
    Jsonb, ServiceLoader
    • Method Detail

      • withConfig

        JsonbBuilder withConfig​(JsonbConfig config)
        Set configuration which will be set to the newly created Jsonb instance.
        config - Configuration for Jsonb instance.
        This JsonbBuilder instance.
      • withProvider

        JsonbBuilder withProvider​(jakarta.json.spi.JsonProvider jsonpProvider)
        Provides a JSON-P provider to be used for all JSON-P related operations.
        jsonpProvider - JsonProvider instance to be used by Jsonb to lookup JSON-P implementation.
        This JsonbBuilder instance.
      • build

        Jsonb build()
        Returns a new instance of Jsonb based on the parameters and configuration specified previously in this builder.
        Jsonb A new instance of Jsonb class. Always a non-null valid object.
        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 in JsonbConfig.
      • create

        static Jsonb create​(JsonbConfig config)
        Create a new Jsonb instance using the default JsonbBuilder implementation provided as returned from JsonbProvider.provider() method, configured with provided configuration.
        config - Provided configuration for Jsonb instance.
        new Jsonb instance.
      • newBuilder

        static JsonbBuilder newBuilder​(JsonbProvider provider)
        Create a new JsonbBuilder instance as returned by provider#create call.
        provider - JsonProvider instance used for creating JsonBuilder instances.
        new JsonbBuilder instance.