public abstract class JsonbProvider
extends java.lang.Object
JsonbProvider provider = JsonbProvider.provider();
}
Specific provider instance lookup:
JsonbProvider provider;
try {
JsonbProvider.provider("foo.bar.ProviderImpl");
} catch (JsonbException e) {
// provider not found or could not be instantiated
}
where 'foo.bar.ProviderImpl
' is a vendor implementation class extending
JsonbProvider
and identified to service loader as
specified in ServiceLoader
documentation.
Jsonb
,
ServiceLoader
Modifier | Constructor and Description |
---|---|
protected |
JsonbProvider()
Protected constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract JsonbBuilder |
create()
Returns a new instance of
JsonbBuilder class. |
static JsonbProvider |
provider()
Creates a JSON Binding provider object by using the
ServiceLoader.load(Class) method. |
static JsonbProvider |
provider(java.lang.String providerName)
Creates a JSON Binding provider object by using the
ServiceLoader.load(Class) method, matching providerName . |
public static JsonbProvider provider()
ServiceLoader.load(Class)
method. The first provider of
JsonbProvider
class from list of providers returned by
ServiceLoader.load
call is returned. If there are no available
service providers, this method tries to load the default service provider using
Class.forName(String)
method.JsonbProvider
instanceJsonbException
- if there is no provider found, or there is a problem
instantiating the provider instance.ServiceLoader
public static JsonbProvider provider(java.lang.String providerName)
ServiceLoader.load(Class)
method, matching providerName
.
The first provider of JsonbProvider
class from list of providers returned by
ServiceLoader.load
call, matching providerName is returned.
If no such provider is found, JsonbException is thrown.providerName
- Class name (class.getName()
) to be chosen from the list of providers
returned by ServiceLoader.load(JsonbProvider.class)
call.JsonbProvider
instanceJsonbException
- if there is no provider found, or there is a problem
instantiating the provider instance.java.lang.NullPointerException
- if providerName is null
.ServiceLoader
public abstract JsonbBuilder create()
JsonbBuilder
class.
JsonbBuilder
provides necessary getter
methods to access required parameters.JsonbBuilder
.
Always a non-null valid object.JsonbException
- If an error was encountered while creating the JsonbBuilder
instance.Jsonb
,
JsonbBuilder