Java Code Examples for org.yaml.snakeyaml.events.ScalarEvent#getStyle()
The following examples show how to use
org.yaml.snakeyaml.events.ScalarEvent#getStyle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Emitter.java From orion.server with Eclipse Public License 1.0 | 6 votes |
private Character chooseScalarStyle() { ScalarEvent ev = (ScalarEvent) event; if (analysis == null) { analysis = analyzeScalar(ev.getValue()); } if (ev.getStyle() != null && ev.getStyle() == '"' || this.canonical) { return '"'; } if (ev.getStyle() == null && ev.getImplicit().canOmitTagInPlainScalar()) { if (!(simpleKeyContext && (analysis.empty || analysis.multiline)) && ((flowLevel != 0 && analysis.allowFlowPlain) || (flowLevel == 0 && analysis.allowBlockPlain))) { return null; } } if (ev.getStyle() != null && (ev.getStyle() == '|' || ev.getStyle() == '>')) { if (flowLevel == 0 && !simpleKeyContext && analysis.allowBlock) { return ev.getStyle(); } } if (ev.getStyle() == null || ev.getStyle() == '\'') { if (analysis.allowSingleQuoted && !(simpleKeyContext && analysis.multiline)) { return '\''; } } return '"'; }
Example 2
Source File: Emitter.java From snake-yaml with Apache License 2.0 | 6 votes |
private Character chooseScalarStyle() { ScalarEvent ev = (ScalarEvent) event; if (analysis == null) { analysis = analyzeScalar(ev.getValue()); } if (ev.getStyle() != null && ev.getStyle() == '"' || this.canonical) { return '"'; } if (ev.getStyle() == null && ev.getImplicit().canOmitTagInPlainScalar()) { if (!(simpleKeyContext && (analysis.empty || analysis.multiline)) && ((flowLevel != 0 && analysis.allowFlowPlain) || (flowLevel == 0 && analysis.allowBlockPlain))) { return null; } } if (ev.getStyle() != null && (ev.getStyle() == '|' || ev.getStyle() == '>')) { if (flowLevel == 0 && !simpleKeyContext && analysis.allowBlock) { return ev.getStyle(); } } if (ev.getStyle() == null || ev.getStyle() == '\'') { if (analysis.allowSingleQuoted && !(simpleKeyContext && analysis.multiline)) { return '\''; } } return '"'; }