- All Implemented Interfaces:
RuntimeType.Api<JsonSupportConfig>,NamedService,NamedService,MediaSupport
public class JsonSupport
extends MediaSupportBase<JsonSupportConfig>
implements RuntimeType.Api<JsonSupportConfig>
Helidon JSON media support.
This media support adds serialization and deserialization for JsonValue.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.helidon.http.media.MediaSupport
MediaSupport.ReaderResponse<T>, MediaSupport.SupportLevel, MediaSupport.WriterResponse<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GenericType<JsonObject> Generic type of this type, as it is required when this media type is used programmatically. -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonSupportConfig.Builderbuilder()Create a new builder forJsonSupport.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 JsonSupportcreate()Create a new instance of JSON Support with default configuration.static JsonSupportcreate(JsonSupportConfig config) Create a new Helidon JSON support from a configuration object.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.static EntityWriter<JsonObject> Create a JSON writer with default settings.<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 io.helidon.http.media.MediaSupportBase
config, isMediaTypeSupported, matchesClientRequest, matchesClientResponse, matchesServerRequest, matchesServerResponse, name, typeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.http.media.MediaSupport
init
-
Field Details
-
JSON_OBJECT_TYPE
Generic type of this type, as it is required when this media type is used programmatically.
-
-
Method Details
-
create
Create a new instance of JSON Support with default configuration.- Returns:
- json media support for
JsonValue
-
builder
Create a new builder forJsonSupport.- Returns:
- a new builder instance
-
create
Create a new Helidon JSON support from a configuration object.- Parameters:
config- the configuration object- Returns:
- a new
JsonSupportinstance
-
serverResponseWriter
Create a JSON writer with default settings.- Returns:
- a writer for
JsonObject
-
prototype
Description copied from interface:RuntimeType.ApiThe prototype as it was received when creating this runtime object instance.- Specified by:
prototypein interfaceRuntimeType.Api<JsonSupportConfig>- 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<JsonSupportConfig>- 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<JsonSupportConfig>- Parameters:
type- type to check- Returns:
- whether this media support can handle this type
-