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:
    Jsonb, ServiceLoader
    • Method Detail

      • withConfig

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

        JsonbBuilder withProvider​(javax.json.spi.JsonProvider jsonpProvider)
        Provides a JSON-P provider to be used for all JSON-P related operations.
        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 of Jsonb 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 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.
        Parameters:
        config - Provided configuration for Jsonb instance.
        Returns:
        new Jsonb instance.
      • newBuilder

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