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 classDumperOptions.FlowStyleBlock styles use indentation to denote nesting and scope within the document.static classDumperOptions.LineBreakPlatform dependent line break.static classDumperOptions.ScalarStyleYAML provides a rich set of scalar styles.static classDumperOptions.VersionSpecification version.
-
Constructor Summary
Constructors Constructor Description DumperOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DumperOptions.ScalarStylecalculateScalarStyle(ScalarAnalysis analysis, DumperOptions.ScalarStyle style)Define the ScalarStyle to be used for emitting scalarsDumperOptions.FlowStylegetDefaultFlowStyle()DumperOptions.ScalarStylegetDefaultScalarStyle()TaggetExplicitRoot()Deprecated.do not use explicit root TagintgetIndent()DumperOptions.LineBreakgetLineBreak()java.util.Map<java.lang.String,java.lang.String>getTags()DumperOptions.VersiongetVersion()intgetWidth()booleanisAllowReadOnlyProperties()Report whether read-only JavaBean properties (the ones without setters) should be included in the YAML documentbooleanisAllowUnicode()booleanisCanonical()booleanisExplicitEnd()booleanisExplicitStart()booleanisPrettyFlow()voidsetAllowReadOnlyProperties(boolean allowReadOnlyProperties)Set to true to include read-only JavaBean properties (the ones without setters) in the YAML document.voidsetAllowUnicode(boolean allowUnicode)Specify whether to emit non-ASCII printable Unicode characters (to support ASCII terminals).voidsetCanonical(boolean canonical)Force the emitter to produce a canonical YAML document.voidsetDefaultFlowStyle(DumperOptions.FlowStyle defaultFlowStyle)voidsetDefaultScalarStyle(DumperOptions.ScalarStyle defaultStyle)Set default style for scalars.voidsetExplicitEnd(boolean explicitEnd)voidsetExplicitRoot(java.lang.String expRoot)Deprecated.use Tag instead of StringvoidsetExplicitRoot(Tag expRoot)Deprecated.do not use explicit root TagvoidsetExplicitStart(boolean explicitStart)voidsetIndent(int indent)voidsetLineBreak(DumperOptions.LineBreak lineBreak)Specify the line break to separate the lines.voidsetPrettyFlow(boolean prettyFlow)Force the emitter to produce a pretty YAML document when using the flow style.voidsetTags(java.util.Map<java.lang.String,java.lang.String> tags)voidsetVersion(DumperOptions.Version version)voidsetWidth(int bestWidth)Specify the preferred width to emit scalars.
-
-
-
Method Detail
-
isAllowUnicode
public boolean isAllowUnicode()
-
setAllowUnicode
public void setAllowUnicode(boolean allowUnicode)
Specify whether to emit non-ASCII printable Unicode characters (to support ASCII terminals). The default value is true.- 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()
-
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 with for scalars.
-
getWidth
public int getWidth()
-
getLineBreak
public DumperOptions.LineBreak getLineBreak()
-
setDefaultFlowStyle
public void setDefaultFlowStyle(DumperOptions.FlowStyle defaultFlowStyle)
-
getDefaultFlowStyle
public DumperOptions.FlowStyle getDefaultFlowStyle()
-
getExplicitRoot
public Tag getExplicitRoot()
Deprecated.do not use explicit root Tag
-
setExplicitRoot
public void setExplicitRoot(java.lang.String expRoot)
Deprecated.use Tag instead of String- Parameters:
expRoot- tag to be used for the root node. (JavaBeans may use Tag.MAP="tag:yaml.org,2002:map")
-
setExplicitRoot
public void setExplicitRoot(Tag expRoot)
Deprecated.do not use explicit root Tag- Parameters:
expRoot- tag to be used for the root node. (JavaBeans may use Tag.MAP="tag:yaml.org,2002:map")
-
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.
-
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)
-
calculateScalarStyle
public DumperOptions.ScalarStyle calculateScalarStyle(ScalarAnalysis analysis, DumperOptions.ScalarStyle style)
Define the ScalarStyle to be used for emitting scalars- Parameters:
analysis- - Scalar meta datastyle- - automatically detected style- Returns:
- ScalarStyle to be used for scalar
-
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
-
-