public abstract class StringQuotingChecker extends Object implements Serializable
YAMLGenerator
to check whether property names and String values need to be quoted or not.
Also contains default logic implementation; may be sub-classes to provide
alternate implementation.Modifier and Type | Class and Description |
---|---|
static class |
StringQuotingChecker.Default
Default
StringQuotingChecker implementation used unless
custom implementation registered. |
Constructor and Description |
---|
StringQuotingChecker() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_isReservedKeyword(int firstChar,
String name) |
protected boolean |
_looksLikeYAMLNumber(int firstChar,
String name) |
protected boolean |
isReservedKeyword(String value)
|
protected boolean |
looksLikeYAMLNumber(String name)
Helper method that sub-classes may use to see if given String value
looks like a YAML 1.1 numeric value and would likely be considered
a number when parsing unless quoting is used.
|
protected boolean |
nameHasQuotableChar(String inputStr)
Looks like we may get names with "funny characters" so.
|
abstract boolean |
needToQuoteName(String name)
Method called by
YAMLGenerator
to check whether given property name should be quoted: usually
to prevent it from being read as non-String key (boolean or number) |
abstract boolean |
needToQuoteValue(String value)
Method called by
YAMLGenerator
to check whether given String value should be quoted: usually
to prevent it from being value of different type (boolean or number). |
protected boolean |
valueHasQuotableChar(String inputStr)
As per YAML Plain Styleunquoted
strings are restricted to a reduced charset and must be quoted in case they contain
one of the following characters or character combinations.
|
public abstract boolean needToQuoteName(String name)
YAMLGenerator
to check whether given property name should be quoted: usually
to prevent it from being read as non-String key (boolean or number)public abstract boolean needToQuoteValue(String value)
YAMLGenerator
to check whether given String value should be quoted: usually
to prevent it from being value of different type (boolean or number).protected boolean isReservedKeyword(String value)
value
- String to checktrue
if given value is a Boolean or Null representation
(as per YAML 1.1 specification) or empty Stringprotected boolean _isReservedKeyword(int firstChar, String name)
protected boolean looksLikeYAMLNumber(String name)
protected boolean _looksLikeYAMLNumber(int firstChar, String name)
protected boolean valueHasQuotableChar(String inputStr)
protected boolean nameHasQuotableChar(String inputStr)
Copyright © 2022 FasterXML. All rights reserved.