Class StringConfigSource

java.lang.Object
com.kamikazejam.kamicommon.yaml.source.StringConfigSource
All Implemented Interfaces:
ConfigSource

public class StringConfigSource extends Object implements ConfigSource
A ConfigSource implementation that reads from a predefined yaml string in memory.

Supports ONLY read operations. Writes unsupported as the source is an immutable string.
Does NOT support defaults via a resource stream.

Source string can be any string parsable by snake-yaml, like the contents of a yaml file.
  • Constructor Details

  • Method Details

    • id

      @NotNull public @NotNull String id()
      Description copied from interface: ConfigSource
      A human-readable identifier for this source (e.g., absolute file path, URL, logical name).
      Uniqueness is not required and the value is intended primarily for logging/debugging.
      Specified by:
      id in interface ConfigSource
      Returns:
      identifier string for this source (not necessarily unique)
    • openStream

      @NotNull public @NotNull Optional<InputStream> openStream()
      Description copied from interface: ConfigSource
      Opens a fresh InputStream for the current contents of this source.
      The caller is responsible for closing the returned stream.
      Specified by:
      openStream in interface ConfigSource
      Returns:
      an Optional containing a new InputStream if content is available; empty if absent
    • getResourceStreamPath

      @Nullable public @Nullable String getResourceStreamPath()
      Description copied from interface: ConfigSource
      Returns the path to a resource stream for default configuration data, if available.
      This is typically used to load default settings bundled with the application/plugin.

      If no resource stream is associated, may return null.
      Specified by:
      getResourceStreamPath in interface ConfigSource