public final class SettingsLoaderFactory
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static SettingsLoader |
loaderFromResource(java.lang.String resourceName)
Returns a
SettingsLoader based on the source resource
name. |
static SettingsLoader |
loaderFromSource(java.lang.String source)
Returns a
SettingsLoader based on the source content. |
public static SettingsLoader loaderFromResource(java.lang.String resourceName)
SettingsLoader
based on the source resource
name. This factory method assumes that if the resource name ends
with ".json" then the content should be parsed as JSON, else if
the resource name ends with ".yml" or ".yaml" then the content
should be parsed as YAML, else if the resource name ends with
".properties" then the content should be parsed as properties,
otherwise default to attempting to parse as JSON. Note that the
parsers returned by this method will not accept null-valued
keys.resourceName
- The resource name containing the settings
content.public static SettingsLoader loaderFromSource(java.lang.String source)
SettingsLoader
based on the source content.
This factory method assumes that if the underlying content
contains an opening and closing brace ('{' and '}') then the
content should be parsed as JSON, else if the underlying content
fails this condition but contains a ':' then the content should
be parsed as YAML, and otherwise should be parsed as properties.
Note that the JSON and YAML parsers returned by this method will
accept null-valued keys.source
- The underlying settings content.