public class YamlFileResource extends Object implements PropertyResource
| Constructor and Description |
|---|
YamlFileResource(File file) |
| Modifier and Type | Method and Description |
|---|---|
protected org.yaml.snakeyaml.Yaml |
createNewYaml() |
PropertyReader |
createReader()
Creates a reader to access the values in the medium (typically a file).
|
void |
exportProperties(ConfigurationData configurationData)
Exports the provided configuration data to the medium (typically a file).
|
protected void |
exportValue(Writer writer,
PropertyPathTraverser pathTraverser,
String path,
Object value)
Exports the given value at the provided path.
|
protected Charset |
getCharset() |
protected File |
getFile() |
protected org.yaml.snakeyaml.Yaml |
getYamlObject()
Returns the YAML instance with which values are converted to YAML.
|
protected String |
indent(int level)
Returns a String of whitespace for indentation in YAML at the given level.
|
protected void |
onWriteComplete()
Called at the end of
exportProperties(ch.jalu.configme.configurationdata.ConfigurationData), regardless whether the execution was successful or not. |
protected String |
toYaml(Object value)
Returns the YAML representation for the given value (belonging to the given value).
|
protected String |
toYamlIndented(Object value,
int indent)
Returns the value in its YAML representation with an indentation of the given level.
|
protected void |
writeComments(Writer writer,
int indentation,
List<String> comments)
Writes the given comment lines as YAML comments at the given indentation level.
|
public YamlFileResource(File file)
public PropertyReader createReader()
PropertyResourceThe reader is discarded after its use and so is not required to refresh itself.
createReader in interface PropertyResourcepublic void exportProperties(ConfigurationData configurationData)
PropertyResourceexportProperties in interface PropertyResourceconfigurationData - the configuration data to exportprotected final File getFile()
protected void exportValue(Writer writer, PropertyPathTraverser pathTraverser, String path, Object value) throws IOException
writer - the file writer to write withpathTraverser - the path traverser (e.g. keeps track of which path elements are new)path - the path to export atvalue - the value to exportIOException - .protected void writeComments(Writer writer, int indentation, List<String> comments) throws IOException
writer - the writer to write withindentation - the level at which the comment lines should be indentedcomments - the comment lines to writeIOException - .protected String toYamlIndented(@Nullable Object value, int indent)
name:).value - the value to convert to YAMLindent - level of indentation to useprotected String toYaml(@Nullable Object value)
value - the value to transform as YAMLprotected String indent(int level)
level - the desired level of indentationprotected void onWriteComplete()
exportProperties(ch.jalu.configme.configurationdata.ConfigurationData), regardless whether the execution was successful or not.protected org.yaml.snakeyaml.Yaml getYamlObject()
protected org.yaml.snakeyaml.Yaml createNewYaml()
protected Charset getCharset()
Copyright © 2016–2018 The AuthMe Team. All rights reserved.