public static class Yamls.YamlExtract
extends java.lang.Object
Constructor and Description |
---|
YamlExtract() |
Modifier and Type | Method and Description |
---|---|
int |
getEndOfPrevious() |
int |
getEndOfThis() |
java.lang.Exception |
getError() |
java.lang.String |
getFullYamlTextOriginal() |
java.lang.String |
getFullYamlTextWithExtractReplaced(java.lang.String replacement)
Returns the original YAML with the found item replaced by the given replacement YAML.
|
org.yaml.snakeyaml.nodes.Node |
getKey() |
java.lang.String |
getMatchedYamlText() |
java.lang.String |
getMatchedYamlTextOrWarn() |
org.yaml.snakeyaml.nodes.Node |
getResult() |
int |
getStartOfNext() |
int |
getStartOfThis() |
java.lang.String |
toString() |
Yamls.YamlExtract |
withKeyIncluded(boolean includeKey)
Specifies whether the key should be included in the found text,
when calling
getMatchedYamlText() or getFullYamlTextWithExtractReplaced(String) ,
if the found item is a map entry. |
Yamls.YamlExtract |
withOriginalIndentation(boolean includeOriginalIndentation)
Specifies whether the original indentation should be preserved
(and in the case of the first line, whether whitespace should be inserted so its start column is preserved),
when calling
getMatchedYamlText() . |
Yamls.YamlExtract |
withPrecedingCommentsIncluded(boolean includePrecedingComments)
Specifies whether comments preceding the found item should be included,
when calling
getMatchedYamlText() or getFullYamlTextWithExtractReplaced(String) . |
public int getEndOfPrevious()
@Nullable public org.yaml.snakeyaml.nodes.Node getKey()
public org.yaml.snakeyaml.nodes.Node getResult()
public int getStartOfThis()
public int getEndOfThis()
public int getStartOfNext()
public java.lang.String getFullYamlTextOriginal()
public java.lang.String getFullYamlTextWithExtractReplaced(java.lang.String replacement)
replacement
- YAML to put in for the found item;
this YAML typically should not have any special indentation -- if required when replacing it will be inserted.
if replacing an inline map entry, the supplied entry must follow the structure being replaced;
for example, if replacing the value in key: value
with a map,
supplying a replacement subkey: value
would result in invalid yaml;
the replacement must be supplied with a newline, either before the subkey or after.
(if unsure we believe it is always valid to include an initial newline or comment with newline.)
public Yamls.YamlExtract withKeyIncluded(boolean includeKey)
getMatchedYamlText()
or getFullYamlTextWithExtractReplaced(String)
,
if the found item is a map entry.
Defaults to false.public Yamls.YamlExtract withPrecedingCommentsIncluded(boolean includePrecedingComments)
getMatchedYamlText()
or getFullYamlTextWithExtractReplaced(String)
.
This will not include comments which are indented further than the item,
as those will typically be aligned with the previous item
(whereas comments whose indentation is the same or less than the found item
will typically be aligned with this item).
Defaults to true.public Yamls.YamlExtract withOriginalIndentation(boolean includeOriginalIndentation)
getMatchedYamlText()
.
Defaults to false, the returned text will be outdented as far as possible.public java.lang.String getMatchedYamlTextOrWarn()
public java.lang.String getMatchedYamlText()
public java.lang.Exception getError()
public java.lang.String toString()
toString
in class java.lang.Object