Class AbstractConfigSource

java.lang.Object
io.helidon.config.AbstractSource
io.helidon.config.AbstractConfigSource
All Implemented Interfaces:
ConfigSource, Source, Supplier<ConfigSource>
Direct Known Subclasses:
AbstractSecretBundleConfigSource, ClasspathConfigSource, DirectoryConfigSource, EtcdConfigSource, FileConfigSource, GitConfigSource, MapConfigSource, UrlConfigSource

public abstract class AbstractConfigSource extends AbstractSource implements ConfigSource
A base implementation for config sources, that combines configuration from any type of a config source. This class does not directly implement the interfaces - this is left to the implementer of the config source. This class provides configuration methods as protected, so you can make them public in your implementation, to only expose methods that must be implemented.

Other methods of the config source interfaces must be implemented by each source as they are data specific, such as PollableSource.isModified(Object). All other methods return reasonable defaults. Config framework analyzes the config source based on interfaces it implements.

See Also:
  • Constructor Details

    • AbstractConfigSource

      protected AbstractConfigSource(AbstractConfigSourceBuilder<?,?> builder)
      Use common data from the builder to setup media type, parser, media type mapping, and parser mapping on this instance. Additional common data is handled by AbstractSource(AbstractSourceBuilder).
      Parameters:
      builder - builder used to set up this config source
  • Method Details

    • mediaType

      protected Optional<String> mediaType()
      Media type if on eis configured for parsing content of ParsableSource. If there is none configured (default), a parser is chosen based on ConfigParser.Content.mediaType() - media type detected during load of data.
      Returns:
      configured media type or empty if none configured
    • parser

      protected Optional<ConfigParser> parser()
      Config parser if one is configured to use for parsing content of ParsableSource. If one is not configured on a source (default), a parser is chosen based on mediaType().
      Returns:
      a configured parser, or empty if one should be chosen from media type (or if this is not a parsable source)
    • toString

      public String toString()
      Overrides:
      toString in class Object