Class StringConfigSource
java.lang.Object
com.kamikazejam.kamicommon.yaml.source.StringConfigSource
- All Implemented Interfaces:
ConfigSource
A
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.
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 Summary
ConstructorsConstructorDescriptionStringConfigSource(@NotNull String content) Construct a config source with the provided yaml content string.
SeeStringConfigSource(java.lang.@org.jetbrains.annotations.NotNull String,java.lang.@org.jetbrains.annotations.Nullable String)for adding a custom ID for logging/debugging.StringConfigSource(@NotNull String content, @Nullable String id) -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns 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.@NotNull Stringid()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.@NotNull Optional<InputStream> Opens a fresh InputStream for the current contents of this source.
The caller is responsible for closing the returned stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.kamikazejam.kamicommon.yaml.source.ConfigSource
asFileIfPresent, ensureExistsIfWritable, isWritable, write
-
Constructor Details
-
StringConfigSource
Construct a config source with the provided yaml content string.
SeeStringConfigSource(java.lang.@org.jetbrains.annotations.NotNull String,java.lang.@org.jetbrains.annotations.Nullable String)for adding a custom ID for logging/debugging. -
StringConfigSource
-
-
Method Details
-
id
Description copied from interface:ConfigSourceA 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:
idin interfaceConfigSource- Returns:
- identifier string for this source (not necessarily unique)
-
openStream
Description copied from interface:ConfigSourceOpens a fresh InputStream for the current contents of this source.
The caller is responsible for closing the returned stream.- Specified by:
openStreamin interfaceConfigSource- Returns:
- an Optional containing a new InputStream if content is available; empty if absent
-
getResourceStreamPath
Description copied from interface:ConfigSourceReturns 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:
getResourceStreamPathin interfaceConfigSource
-