- java.lang.Object
-
- io.helidon.media.common.MediaContext.Builder
-
- All Implemented Interfaces:
Builder<MediaContext>
,MediaContextBuilder<MediaContext.Builder>
,Supplier<MediaContext>
- Enclosing class:
- MediaContext
public static class MediaContext.Builder extends Object implements Builder<MediaContext>, MediaContextBuilder<MediaContext.Builder>
MediaSupport builder.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MediaContext.Builder
addMediaSupport(MediaSupport mediaSupport)
Adds new instance ofMediaSupport
.MediaContext.Builder
addMediaSupport(MediaSupport mediaSupport, int priority)
Adds new instance ofMediaSupport
with specific priority.MediaContext.Builder
addReader(MessageBodyReader<?> reader)
Registers new reader.MediaContext.Builder
addStreamReader(MessageBodyStreamReader<?> streamReader)
Registers new stream reader.MediaContext.Builder
addStreamWriter(MessageBodyStreamWriter<?> streamWriter)
Registers new stream writer.MediaContext.Builder
addWriter(MessageBodyWriter<?> writer)
Registers new writer.MediaContext
build()
Build the instance from this builder.MediaContext.Builder
config(Config config)
Configures thisMediaContext.Builder
from the suppliedConfig
.MediaContext.Builder
discoverServices(boolean discoverServices)
Whether Java Service Loader should be used to loadMediaSupportProvider
.MediaContext.Builder
filterServices(boolean filterServices)
Whether services loaded by Java Service Loader should be filtered.MediaContext.Builder
registerDefaults(boolean registerDefaults)
Whether defaults should be included.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.media.common.MediaContextBuilder
addMediaSupport, addReader, addStreamReader, addStreamWriter, addWriter
-
-
-
-
Method Detail
-
config
public MediaContext.Builder config(Config config)
Configures thisMediaContext.Builder
from the suppliedConfig
.Optional configuration parameters key description register-defaults Whether to register default reader and writers discover-services Whether to discover services via service loader filter-services Whether to filter discovered services by service names in services section services Configuration section for each service. Each entry has to have "name" parameter. It is also used for filtering of loaded services. - Parameters:
config
- aConfig
- Returns:
- this
MediaContext.Builder
-
addMediaSupport
public MediaContext.Builder addMediaSupport(MediaSupport mediaSupport)
Description copied from interface:MediaContextBuilder
Adds new instance ofMediaSupport
.- Specified by:
addMediaSupport
in interfaceMediaContextBuilder<MediaContext.Builder>
- Parameters:
mediaSupport
- media support- Returns:
- updated instance of the builder
-
addMediaSupport
public MediaContext.Builder addMediaSupport(MediaSupport mediaSupport, int priority)
Adds new instance ofMediaSupport
with specific priority.- Parameters:
mediaSupport
- media supportpriority
- priority- Returns:
- updated instance of the builder
-
addReader
public MediaContext.Builder addReader(MessageBodyReader<?> reader)
Description copied from interface:MediaContextBuilder
Registers new reader.- Specified by:
addReader
in interfaceMediaContextBuilder<MediaContext.Builder>
- Parameters:
reader
- reader- Returns:
- updated instance of the builder
-
addStreamReader
public MediaContext.Builder addStreamReader(MessageBodyStreamReader<?> streamReader)
Description copied from interface:MediaContextBuilder
Registers new stream reader.- Specified by:
addStreamReader
in interfaceMediaContextBuilder<MediaContext.Builder>
- Parameters:
streamReader
- stream reader- Returns:
- updated instance of the builder
-
addWriter
public MediaContext.Builder addWriter(MessageBodyWriter<?> writer)
Description copied from interface:MediaContextBuilder
Registers new writer.- Specified by:
addWriter
in interfaceMediaContextBuilder<MediaContext.Builder>
- Parameters:
writer
- writer- Returns:
- updated instance of the builder
-
addStreamWriter
public MediaContext.Builder addStreamWriter(MessageBodyStreamWriter<?> streamWriter)
Description copied from interface:MediaContextBuilder
Registers new stream writer.- Specified by:
addStreamWriter
in interfaceMediaContextBuilder<MediaContext.Builder>
- Parameters:
streamWriter
- stream writer- Returns:
- updated instance of the builder
-
registerDefaults
public MediaContext.Builder registerDefaults(boolean registerDefaults)
Whether defaults should be included.- Parameters:
registerDefaults
- register defaults- Returns:
- this builder instance
-
discoverServices
public MediaContext.Builder discoverServices(boolean discoverServices)
Whether Java Service Loader should be used to loadMediaSupportProvider
.- Parameters:
discoverServices
- use Java Service Loader- Returns:
- this builder instance
-
filterServices
public MediaContext.Builder filterServices(boolean filterServices)
Whether services loaded by Java Service Loader should be filtered. All of the services which should pass the filter, have to be present underservices
section of configuration.- Parameters:
filterServices
- filter services- Returns:
- this builder instance
-
build
public MediaContext build()
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<MediaContext>
- Returns:
- instance of the built type
-
-