Class MediaContextConfig.BuilderBase<BUILDER extends MediaContextConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends MediaContextConfig>

java.lang.Object
io.helidon.http.media.MediaContextConfig.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
MediaContextConfig.Builder
Enclosing interface:
MediaContextConfig

public abstract static class MediaContextConfig.BuilderBase<BUILDER extends MediaContextConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends MediaContextConfig> extends Object implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for MediaContext.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(MediaContextConfig prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(MediaContextConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface Prototype.ConfiguredBuilder<BUILDER extends MediaContextConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends MediaContextConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • mediaSupportsDiscoverServices

      public BUILDER mediaSupportsDiscoverServices(boolean discoverServices)
      Media supports to use. This instance has priority over provider(s) discovered by service loader. The providers are used in order of calling this method, where the first support added is the first one to be queried for readers and writers.
      Parameters:
      discoverServices - whether to discover implementations through service loader
      Returns:
      updated builder instance
      See Also:
    • mediaSupports

      public BUILDER mediaSupports(List<? extends MediaSupport> mediaSupports)
      Media supports to use. This instance has priority over provider(s) discovered by service loader. The providers are used in order of calling this method, where the first support added is the first one to be queried for readers and writers.
      Parameters:
      mediaSupports - media supports
      Returns:
      updated builder instance
      See Also:
    • addMediaSupports

      public BUILDER addMediaSupports(List<? extends MediaSupport> mediaSupports)
      Media supports to use. This instance has priority over provider(s) discovered by service loader. The providers are used in order of calling this method, where the first support added is the first one to be queried for readers and writers.
      Parameters:
      mediaSupports - media supports
      Returns:
      updated builder instance
      See Also:
    • addMediaSupport

      public BUILDER addMediaSupport(MediaSupport mediaSupport)
      Media supports to use. This instance has priority over provider(s) discovered by service loader. The providers are used in order of calling this method, where the first support added is the first one to be queried for readers and writers.
      Parameters:
      mediaSupport - media supports
      Returns:
      updated builder instance
      See Also:
    • clearFallback

      public BUILDER clearFallback()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • fallback

      public BUILDER fallback(MediaContext fallback)
      Existing context to be used as a fallback for this context.
      Parameters:
      fallback - media context to use if supports configured on this request cannot provide a good result
      Returns:
      updated builder instance
      See Also:
    • fallback

      public BUILDER fallback(MediaContextConfig fallbackConfig)
      Existing context to be used as a fallback for this context.
      Parameters:
      fallbackConfig - media context to use if supports configured on this request cannot provide a good result
      Returns:
      updated builder instance
      See Also:
    • fallback

      public BUILDER fallback(Consumer<MediaContextConfig.Builder> consumer)
      Existing context to be used as a fallback for this context.
      Parameters:
      consumer - media context to use if supports configured on this request cannot provide a good result
      Returns:
      updated builder instance
      See Also:
    • registerDefaults

      public BUILDER registerDefaults(boolean registerDefaults)
      Should we register defaults of Helidon, such as String media support.
      Parameters:
      registerDefaults - whether to register default media supports
      Returns:
      updated builder instance
      See Also:
    • mediaSupports

      public List<MediaSupport> mediaSupports()
      Media supports to use. This instance has priority over provider(s) discovered by service loader. The providers are used in order of calling this method, where the first support added is the first one to be queried for readers and writers.
      Returns:
      the media supports
    • fallback

      public Optional<MediaContext> fallback()
      Existing context to be used as a fallback for this context.
      Returns:
      the fallback
    • registerDefaults

      public boolean registerDefaults()
      Should we register defaults of Helidon, such as String media support.
      Returns:
      the register defaults
    • config

      public Optional<Config> config()
      If this instance was configured, this would be the config instance used.
      Returns:
      config node used to configure this builder, or empty if not configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.