public class YamlFileResource extends Object implements PropertyResource
| Constructor and Description |
|---|
YamlFileResource(File file)
Deprecated.
scheduled for removal
|
YamlFileResource(Path path) |
YamlFileResource(Path path,
YamlFileResourceOptions options) |
| Modifier and Type | Method and Description |
|---|---|
protected List<String> |
combinePathElementsAndMapEntryKey(List<String> parentPathElements,
String mapEntryKey)
Combines two path element sources to a new list of path elements: the list of path elements that were given
from the parent context and the map entry key from which one or more path elements should be derived.
|
protected org.yaml.snakeyaml.Yaml |
createNewYaml() |
PropertyReader |
createReader()
Creates a reader to access the values in the medium (typically a file).
|
protected String |
escapePathElementIfNeeded(String path) |
void |
exportProperties(ConfigurationData configurationData)
Exports the provided configuration data to the medium (typically a file).
|
protected void |
exportValue(Writer writer,
PropertyPathTraverser pathTraverser,
List<String> pathElements,
Object value)
Exports the given value at the provided path.
|
protected File |
getFile()
Deprecated.
|
protected YamlFileResourceOptions |
getOptions() |
protected Path |
getPath() |
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,
PropertyPathTraverser.PathElement pathElement)
Writes the given comment lines as YAML comments at the given indentation level.
|
public YamlFileResource(Path path)
public YamlFileResource(Path path, YamlFileResourceOptions options)
@Deprecated public YamlFileResource(File file)
YamlFileResource(Path).file - the filepublic 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 Path getPath()
@Deprecated protected final File getFile()
protected void exportValue(Writer writer, PropertyPathTraverser pathTraverser, List<String> pathElements, Object value) throws IOException
writer - the file writer to write withpathTraverser - the path traverser (e.g. keeps track of which path elements are new)pathElements - all elements that make up the path to the valuevalue - the value to exportIOException - .protected void writeComments(Writer writer, int indentation, PropertyPathTraverser.PathElement pathElement) throws IOException
writer - the writer to write withindentation - the level at which the comment lines should be indentedpathElement - the path element for which the comments are being generatedIOException - .protected List<String> combinePathElementsAndMapEntryKey(List<String> parentPathElements, String mapEntryKey)
parentPathElements - the path elements that were previously givenmapEntryKey - the key of a map entry which is added to the pathprotected 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 final YamlFileResourceOptions getOptions()
Copyright © 2016–2021 The AuthMe Team. All rights reserved.