Package org.yaml.snakeyaml
Class DumperOptions
- java.lang.Object
-
- org.yaml.snakeyaml.DumperOptions
-
public class DumperOptions extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DumperOptions.FlowStyle
Block styles use indentation to denote nesting and scope within the document.static class
DumperOptions.LineBreak
Platform dependent line break.static class
DumperOptions.NonPrintableStyle
static class
DumperOptions.ScalarStyle
YAML provides a rich set of scalar styles.static class
DumperOptions.Version
Specification version.
-
Field Summary
Fields Modifier and Type Field Description private boolean
allowReadOnlyProperties
private boolean
allowUnicode
private AnchorGenerator
anchorGenerator
private int
bestWidth
private boolean
canonical
private DumperOptions.FlowStyle
defaultFlowStyle
private DumperOptions.ScalarStyle
defaultStyle
private boolean
explicitEnd
private boolean
explicitStart
private int
indent
private boolean
indentWithIndicator
private int
indicatorIndent
private DumperOptions.LineBreak
lineBreak
private int
maxSimpleKeyLength
private DumperOptions.NonPrintableStyle
nonPrintableStyle
private java.lang.Boolean
prettyFlow
private boolean
processComments
private boolean
splitLines
private java.util.Map<java.lang.String,java.lang.String>
tags
private java.util.TimeZone
timeZone
private DumperOptions.Version
version
-
Constructor Summary
Constructors Constructor Description DumperOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnchorGenerator
getAnchorGenerator()
DumperOptions.FlowStyle
getDefaultFlowStyle()
DumperOptions.ScalarStyle
getDefaultScalarStyle()
int
getIndent()
boolean
getIndentWithIndicator()
int
getIndicatorIndent()
DumperOptions.LineBreak
getLineBreak()
int
getMaxSimpleKeyLength()
DumperOptions.NonPrintableStyle
getNonPrintableStyle()
boolean
getSplitLines()
java.util.Map<java.lang.String,java.lang.String>
getTags()
java.util.TimeZone
getTimeZone()
DumperOptions.Version
getVersion()
int
getWidth()
boolean
isAllowReadOnlyProperties()
Report whether read-only JavaBean properties (the ones without setters) should be included in the YAML documentboolean
isAllowUnicode()
boolean
isCanonical()
boolean
isExplicitEnd()
boolean
isExplicitStart()
boolean
isPrettyFlow()
boolean
isProcessComments()
void
setAllowReadOnlyProperties(boolean allowReadOnlyProperties)
Set to true to include read-only JavaBean properties (the ones without setters) in the YAML document.void
setAllowUnicode(boolean allowUnicode)
Specify whether to emit non-ASCII printable Unicode characters.void
setAnchorGenerator(AnchorGenerator anchorGenerator)
void
setCanonical(boolean canonical)
Force the emitter to produce a canonical YAML document.void
setDefaultFlowStyle(DumperOptions.FlowStyle defaultFlowStyle)
void
setDefaultScalarStyle(DumperOptions.ScalarStyle defaultStyle)
Set default style for scalars.void
setExplicitEnd(boolean explicitEnd)
void
setExplicitStart(boolean explicitStart)
void
setIndent(int indent)
void
setIndentWithIndicator(boolean indentWithIndicator)
Set to true to add the indent for sequences to the general indentvoid
setIndicatorIndent(int indicatorIndent)
Set number of white spaces to use for the sequence indicator '-'void
setLineBreak(DumperOptions.LineBreak lineBreak)
Specify the line break to separate the lines.void
setMaxSimpleKeyLength(int maxSimpleKeyLength)
Define max key length to use simple key (without '?') More info https://yaml.org/spec/1.1/#id934537void
setNonPrintableStyle(DumperOptions.NonPrintableStyle style)
When String contains non-printable characters SnakeYAML convert it to binary data with the !!binary tag.void
setPrettyFlow(boolean prettyFlow)
Force the emitter to produce a pretty YAML document when using the flow style.void
setProcessComments(boolean processComments)
Set the comment processing.void
setSplitLines(boolean splitLines)
Specify whether to split lines exceeding preferred width for scalars.void
setTags(java.util.Map<java.lang.String,java.lang.String> tags)
void
setTimeZone(java.util.TimeZone timeZone)
Set the timezone to be used for Date.void
setVersion(DumperOptions.Version version)
void
setWidth(int bestWidth)
Specify the preferred width to emit scalars.
-
-
-
Field Detail
-
defaultStyle
private DumperOptions.ScalarStyle defaultStyle
-
defaultFlowStyle
private DumperOptions.FlowStyle defaultFlowStyle
-
canonical
private boolean canonical
-
allowUnicode
private boolean allowUnicode
-
allowReadOnlyProperties
private boolean allowReadOnlyProperties
-
indent
private int indent
-
indicatorIndent
private int indicatorIndent
-
indentWithIndicator
private boolean indentWithIndicator
-
bestWidth
private int bestWidth
-
splitLines
private boolean splitLines
-
lineBreak
private DumperOptions.LineBreak lineBreak
-
explicitStart
private boolean explicitStart
-
explicitEnd
private boolean explicitEnd
-
timeZone
private java.util.TimeZone timeZone
-
maxSimpleKeyLength
private int maxSimpleKeyLength
-
processComments
private boolean processComments
-
nonPrintableStyle
private DumperOptions.NonPrintableStyle nonPrintableStyle
-
version
private DumperOptions.Version version
-
tags
private java.util.Map<java.lang.String,java.lang.String> tags
-
prettyFlow
private java.lang.Boolean prettyFlow
-
anchorGenerator
private AnchorGenerator anchorGenerator
-
-
Method Detail
-
isAllowUnicode
public boolean isAllowUnicode()
-
setAllowUnicode
public void setAllowUnicode(boolean allowUnicode)
Specify whether to emit non-ASCII printable Unicode characters. The default value is true. When set to false then printable non-ASCII characters (Cyrillic, Chinese etc) will be not printed but escaped (to support ASCII terminals)- Parameters:
allowUnicode
- if allowUnicode is false then all non-ASCII characters are escaped
-
getDefaultScalarStyle
public DumperOptions.ScalarStyle getDefaultScalarStyle()
-
setDefaultScalarStyle
public void setDefaultScalarStyle(DumperOptions.ScalarStyle defaultStyle)
Set default style for scalars. See YAML 1.1 specification, 2.3 Scalars (http://yaml.org/spec/1.1/#id858081)- Parameters:
defaultStyle
- set the style for all scalars
-
setIndent
public void setIndent(int indent)
-
getIndent
public int getIndent()
-
setIndicatorIndent
public void setIndicatorIndent(int indicatorIndent)
Set number of white spaces to use for the sequence indicator '-'- Parameters:
indicatorIndent
- value to be used as indent
-
getIndicatorIndent
public int getIndicatorIndent()
-
getIndentWithIndicator
public boolean getIndentWithIndicator()
-
setIndentWithIndicator
public void setIndentWithIndicator(boolean indentWithIndicator)
Set to true to add the indent for sequences to the general indent- Parameters:
indentWithIndicator
- - true when indent for sequences is added to general
-
setVersion
public void setVersion(DumperOptions.Version version)
-
getVersion
public DumperOptions.Version getVersion()
-
setCanonical
public void setCanonical(boolean canonical)
Force the emitter to produce a canonical YAML document.- Parameters:
canonical
- true produce canonical YAML document
-
isCanonical
public boolean isCanonical()
-
setPrettyFlow
public void setPrettyFlow(boolean prettyFlow)
Force the emitter to produce a pretty YAML document when using the flow style.- Parameters:
prettyFlow
- true produce pretty flow YAML document
-
isPrettyFlow
public boolean isPrettyFlow()
-
setWidth
public void setWidth(int bestWidth)
Specify the preferred width to emit scalars. When the scalar representation takes more then the preferred with the scalar will be split into a few lines. The default is 80.- Parameters:
bestWidth
- the preferred width for scalars.
-
getWidth
public int getWidth()
-
setSplitLines
public void setSplitLines(boolean splitLines)
Specify whether to split lines exceeding preferred width for scalars. The default is true.- Parameters:
splitLines
- whether to split lines exceeding preferred width for scalars.
-
getSplitLines
public boolean getSplitLines()
-
getLineBreak
public DumperOptions.LineBreak getLineBreak()
-
setDefaultFlowStyle
public void setDefaultFlowStyle(DumperOptions.FlowStyle defaultFlowStyle)
-
getDefaultFlowStyle
public DumperOptions.FlowStyle getDefaultFlowStyle()
-
setLineBreak
public void setLineBreak(DumperOptions.LineBreak lineBreak)
Specify the line break to separate the lines. It is platform specific: Windows - "\r\n", old MacOS - "\r", Unix - "\n". The default value is the one for Unix.- Parameters:
lineBreak
- to be used for the input
-
isExplicitStart
public boolean isExplicitStart()
-
setExplicitStart
public void setExplicitStart(boolean explicitStart)
-
isExplicitEnd
public boolean isExplicitEnd()
-
setExplicitEnd
public void setExplicitEnd(boolean explicitEnd)
-
getTags
public java.util.Map<java.lang.String,java.lang.String> getTags()
-
setTags
public void setTags(java.util.Map<java.lang.String,java.lang.String> tags)
-
isAllowReadOnlyProperties
public boolean isAllowReadOnlyProperties()
Report whether read-only JavaBean properties (the ones without setters) should be included in the YAML document- Returns:
- false when read-only JavaBean properties are not emitted
-
setAllowReadOnlyProperties
public void setAllowReadOnlyProperties(boolean allowReadOnlyProperties)
Set to true to include read-only JavaBean properties (the ones without setters) in the YAML document. By default these properties are not included to be able to parse later the same JavaBean.- Parameters:
allowReadOnlyProperties
- - true to dump read-only JavaBean properties
-
getTimeZone
public java.util.TimeZone getTimeZone()
-
setTimeZone
public void setTimeZone(java.util.TimeZone timeZone)
Set the timezone to be used for Date. If set tonull
UTC is used.- Parameters:
timeZone
- for created Dates or null to use UTC
-
getAnchorGenerator
public AnchorGenerator getAnchorGenerator()
-
setAnchorGenerator
public void setAnchorGenerator(AnchorGenerator anchorGenerator)
-
getMaxSimpleKeyLength
public int getMaxSimpleKeyLength()
-
setMaxSimpleKeyLength
public void setMaxSimpleKeyLength(int maxSimpleKeyLength)
Define max key length to use simple key (without '?') More info https://yaml.org/spec/1.1/#id934537- Parameters:
maxSimpleKeyLength
- - the limit after which the key gets explicit key indicator '?'
-
setProcessComments
public void setProcessComments(boolean processComments)
Set the comment processing. By default comments are ignored.- Parameters:
processComments
-true
to process;false
to ignore
-
isProcessComments
public boolean isProcessComments()
-
getNonPrintableStyle
public DumperOptions.NonPrintableStyle getNonPrintableStyle()
-
setNonPrintableStyle
public void setNonPrintableStyle(DumperOptions.NonPrintableStyle style)
When String contains non-printable characters SnakeYAML convert it to binary data with the !!binary tag. Set this to ESCAPE to keep the !!str tag and escape the non-printable chars with \\x or \\u- Parameters:
style
- ESCAPE to force SnakeYAML to keep !!str tag for non-printable data
-
-