Class JsonBindingSupport
java.lang.Object
io.helidon.http.media.MediaSupportBase<JsonBindingSupportConfig>
io.helidon.http.media.json.binding.JsonBindingSupport
- All Implemented Interfaces:
RuntimeType.Api<JsonBindingSupportConfig>, NamedService, MediaSupport
public class JsonBindingSupport
extends MediaSupportBase<JsonBindingSupportConfig>
implements RuntimeType.Api<JsonBindingSupportConfig>
Helidon JSON Binding media support implementation.
This class provides comprehensive JSON Binding media support for Helidon HTTP, enabling automatic serialization and deserialization of Java objects to/from JSON format in HTTP requests and responses. It supports content negotiation, character encoding detection, and integrates with the Helidon media support framework.
-
Nested Class Summary
Nested classes/interfaces inherited from interface MediaSupport
MediaSupport.ReaderResponse<T>, MediaSupport.SupportLevel, MediaSupport.WriterResponse<T>Modifier and TypeInterfaceDescriptionstatic final recordReader response.static enumHow does this provider support the entity type.static final recordWriter response. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a new builder forJsonBindingSupport.protected booleancanDeserialize(GenericType<?> type) Check whether the type is supported by this media support for deserialization.protected booleancanSerialize(GenericType<?> type) Check whether the type is supported by this media support for serialization.static MediaSupportcreate()Create a new Helidon JSON Binding media support with default configuration.static MediaSupportCreate a new Helidon JSON media support from configuration.static MediaSupportCreate a new Helidon JSON media support from configuration with a custom name.static JsonBindingSupportcreate(JsonBindingSupportConfig config) Create a new Helidon JSON Binding support from a configuration object.static JsonBindingSupportcreate(Consumer<JsonBindingSupportConfig.Builder> consumer) Create a new Helidon JSON support using a configuration consumer.The prototype as it was received when creating this runtime object instance.<T> MediaSupport.ReaderResponse<T> reader(GenericType<T> type, Headers requestHeaders) Reader for an entity.<T> MediaSupport.ReaderResponse<T> reader(GenericType<T> type, Headers requestHeaders, Headers responseHeaders) Client response reader.type()Type of this implementation, to distinguish instances of same type, with differentNamedService.name().<T> MediaSupport.WriterResponse<T> writer(GenericType<T> type, Headers requestHeaders, WritableHeaders<?> responseHeaders) Server response writer.<T> MediaSupport.WriterResponse<T> writer(GenericType<T> type, WritableHeaders<?> requestHeaders) Client request writer.Methods inherited from class MediaSupportBase
config, isMediaTypeSupported, matchesClientRequest, matchesClientResponse, matchesServerRequest, matchesServerResponse, nameModifier and TypeMethodDescriptionprotected JsonBindingSupportConfigconfig()The configuration object used to create this instance.protected booleanisMediaTypeSupported(HttpMediaType mediaType) Check whether the provided media type is one of the supported media types.protected booleanmatchesClientRequest(GenericType<?> type, Headers requestHeaders) Client request writer check.protected booleanmatchesClientResponse(GenericType<?> type, Headers responseHeaders) Client response reader check.protected booleanmatchesServerRequest(GenericType<?> type, Headers requestHeaders) Server request reader check.protected booleanmatchesServerResponse(GenericType<?> type, Headers requestHeaders, Headers responseHeaders) Server response writer check.name()Name of this implementation, as provided inConfiguredProvider.create(Config, String).Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MediaSupport
initModifier and TypeMethodDescriptiondefault voidinit(MediaContext context) Once all providers are discovered/configured and context is established, theMediaContextcalls this method on all providers to allow sub-resolution of readers and writers.
-
Method Details
-
create
Create a new Helidon JSON media support from configuration.- Parameters:
config- the configuration to use- Returns:
- a new
JsonBindingSupportinstance
-
create
Create a new Helidon JSON Binding media support with default configuration.- Returns:
- a new
JsonBindingSupportinstance
-
create
Create a new Helidon JSON media support from configuration with a custom name.- Parameters:
config- the configuration to usename- the name for this media support instance- Returns:
- a new MediaSupport instance
-
create
Create a new Helidon JSON Binding support from a configuration object.- Parameters:
config- the configuration object- Returns:
- a new
JsonBindingSupportinstance
-
create
Create a new Helidon JSON support using a configuration consumer.- Parameters:
consumer- the consumer to configure the builder- Returns:
- a new
JsonBindingSupportinstance
-
builder
Create a new builder forJsonBindingSupport.- Returns:
- a new builder instance
-
type
Description copied from interface:NamedServiceType of this implementation, to distinguish instances of same type, with differentNamedService.name(). Use for exampleConfiguredProvider.configKey()to define the type.- Specified by:
typein interfaceNamedService- Overrides:
typein classMediaSupportBase<JsonBindingSupportConfig>- Returns:
- type of this service
-
prototype
Description copied from interface:RuntimeType.ApiThe prototype as it was received when creating this runtime object instance.- Specified by:
prototypein interfaceRuntimeType.Api<JsonBindingSupportConfig>- Returns:
- prototype object used to create this instance
-
reader
Description copied from interface:MediaSupportReader for an entity.- Specified by:
readerin interfaceMediaSupport- Type Parameters:
T- type- Parameters:
type- type of entityrequestHeaders- headers belonging to this entity (such as server request headers), expected to have content type- Returns:
- reader response, whether this type is supported or not
-
writer
public <T> MediaSupport.WriterResponse<T> writer(GenericType<T> type, Headers requestHeaders, WritableHeaders<?> responseHeaders) Description copied from interface:MediaSupportServer response writer.- Specified by:
writerin interfaceMediaSupport- Type Parameters:
T- type- Parameters:
type- type of entityrequestHeaders- request headersresponseHeaders- response headers- Returns:
- writer response, whether this type is supported or not
-
reader
public <T> MediaSupport.ReaderResponse<T> reader(GenericType<T> type, Headers requestHeaders, Headers responseHeaders) Description copied from interface:MediaSupportClient response reader.- Specified by:
readerin interfaceMediaSupport- Type Parameters:
T- type- Parameters:
type- type of entityrequestHeaders- request headersresponseHeaders- response headers- Returns:
- reader response, whether this type is supported or not
-
writer
public <T> MediaSupport.WriterResponse<T> writer(GenericType<T> type, WritableHeaders<?> requestHeaders) Description copied from interface:MediaSupportClient request writer.- Specified by:
writerin interfaceMediaSupport- Type Parameters:
T- type- Parameters:
type- type of entityrequestHeaders- request headers- Returns:
- writer response, whether this type is supported or not
-
canSerialize
Description copied from class:MediaSupportBaseCheck whether the type is supported by this media support for serialization.- Specified by:
canSerializein classMediaSupportBase<JsonBindingSupportConfig>- Parameters:
type- type to check- Returns:
- whether this media support can handle this type
-
canDeserialize
Description copied from class:MediaSupportBaseCheck whether the type is supported by this media support for deserialization.- Specified by:
canDeserializein classMediaSupportBase<JsonBindingSupportConfig>- Parameters:
type- type to check- Returns:
- whether this media support can handle this type
-