Package valorless.valorlessutils.json
Class CompactYamlRepresenter
java.lang.Object
org.yaml.snakeyaml.representer.BaseRepresenter
org.yaml.snakeyaml.representer.Representer
org.bukkit.configuration.file.YamlRepresenter
valorless.valorlessutils.json.CompactYamlRepresenter
public class CompactYamlRepresenter
extends org.bukkit.configuration.file.YamlRepresenter
There are situations in which SnakeYaml uses the literal block style by default and thereby
produces output with line breaks. This includes for example:
- Strings that contain non-printable characters and are therefore considered to be binary data.
- Strings and characters that contain newline characters when the used scalar style is
DumperOptions.ScalarStyle.PLAIN
. - Byte arrays, which are also considered binary data.
- Custom representers may also decide to forcefully use block styles.
For our compact Yaml representation we want to produce Yaml output without any line breaks in all
situations. This Representer
therefore enforces the use of the scalar style
DumperOptions.ScalarStyle.DOUBLE_QUOTED
for any scalars that contain newline characters.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.yaml.snakeyaml.representer.Representer
org.yaml.snakeyaml.representer.Representer.RepresentJavaBean
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.yaml.snakeyaml.DumperOptions.NonPrintableStyle
protected TimeZone
Fields inherited from class org.yaml.snakeyaml.representer.Representer
typeDefinitions
Fields inherited from class org.yaml.snakeyaml.representer.BaseRepresenter
defaultFlowStyle, defaultScalarStyle, multiRepresenters, nullRepresenter, objectToRepresent, representedObjects, representers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.yaml.snakeyaml.nodes.Tag
addClassTag
(Class<? extends Object> arg0, org.yaml.snakeyaml.nodes.Tag arg1) protected org.yaml.snakeyaml.nodes.Tag
protected org.yaml.snakeyaml.nodes.Node
representScalar
(@Nullable org.yaml.snakeyaml.nodes.Tag tag, @Nullable String value, @Nullable org.yaml.snakeyaml.DumperOptions.ScalarStyle style) void
setTimeZone
(TimeZone arg0) Methods inherited from class org.yaml.snakeyaml.representer.Representer
addTypeDescription, checkGlobalTag, getProperties, representJavaBean, representJavaBeanProperty, setPropertyUtils
Methods inherited from class org.yaml.snakeyaml.representer.BaseRepresenter
getDefaultFlowStyle, getDefaultScalarStyle, getPropertyUtils, isExplicitPropertyUtils, represent, representData, representMapping, representScalar, representSequence, setDefaultFlowStyle, setDefaultScalarStyle
-
Field Details
-
classTags
-
timeZone
-
nonPrintableStyle
protected org.yaml.snakeyaml.DumperOptions.NonPrintableStyle nonPrintableStyle
-
-
Constructor Details
-
CompactYamlRepresenter
public CompactYamlRepresenter()
-
-
Method Details
-
representScalar
protected org.yaml.snakeyaml.nodes.Node representScalar(@Nullable org.yaml.snakeyaml.nodes.Tag tag, @Nullable String value, @Nullable org.yaml.snakeyaml.DumperOptions.ScalarStyle style) - Overrides:
representScalar
in classorg.yaml.snakeyaml.representer.BaseRepresenter
-
getTag
-
addClassTag
-
getTimeZone
-
setTimeZone
-