This is for #186 / #282 as an alternative to adding
a ton of getFooOrNull methods. With these methods apps
can handle null or missing settings in a special way
if they see fit.
Update the single value parsing method to throw an exception
when there is leading or trailing whitespace. Modify concatenation
parsing in the ConfigDocumentParser to put back any trailing
whitespace. Add a hashCode method for AbstractConfigNodes.
Implement an `equals()` method for AbstractConfigNodes. Add a
test to ensure an exception is thrown when calling setValue()
on a ConfigDocument when passing in a value with HOCON syntax
when the document was parsed as JSON. Add a setValue() method to
the ConfigDocument interface that takes a ConfigValue instead of
a String. When parsing a single value, throw an exception if a
concatenation is seen when parsing JSON.
Make the javadoc string for the ConfigDocument interface more
explicit about what it does with the value string when setting
a value. Add support for parsing a reader into a ConfigDocument.
Improve the field addition in node replacement so that it will
create any non-existent objects along the desired path to the
desired value. Modify Path Node parsing so that subpaths can
be retrieved with the necessary tokens for those subpaths.
Ensure that the addition of a new field in a JSON document
results in valid JSON.
Add three new classes, ConfigNodeObject, ConfigNodeArray, and
ConfigNodeConcatenation, to differentiate the three types of
complex nodes. Disallow setting values outside of
ConfigNodeObjects.
Refactor the parseConcatenation() method in ConfigDocumentParser
to not throw out parsed values if only one value was seen. Rename
parseConcatenation to consolidateValues().
Create a new Parser, ConfigDocumentParser, which can parse an
input reader into a ConfigNodeComplexValue, which can
then be used to reproduce the exact original text of the input.
Address ConfigNode PR feedback, including
* Add @Override tags for all tokens() methods
* Make `children()` method in ConfigNodeComplexValue final
* Rename ConfigNodeKey to ConfigNodePath
* Rename ConfigNodeKeyValue to ConfigNodeField
* Modify PathParser so it can parse a string into either a Path
or a ConfigNodePath
Save the list of Tokens from which a Path was created when a
Path is parsed from a string in Parser.parsePath. Change
ConfigNodeKey to store a Path instead of a token.
Address various PR feedback, including:
* Remove unused map from ConfigNodeComplexValue
* Stop caching KeyValue indexes in ConfigNodeComplexValue
* Return an Iterable<Token> for the children() methods in
ConfigNodeComplexValue and ConfigNodeKeyValue
* Change all ConfigNode classes to implement AbstractConfigNode
* Remove the constructor and the token instance variable
from AbstractConfigNode. Make the render() method final and
have it use a new tokens() method which returns the list
of tokens contained by the node.
* Stop caching values in ConfigNodeKeyValue
Remove repeats of a key when setting a value in a
ConfigNodeComplexValue. Add a new node type, ConfigNodeKeyValue,
to represent a key-value pair and its surrounding whitespace.
Add various ConfigNode classes to represent the various
ConfigNode types. All of these are fully functional, with the
exception of ConfigNodeComplexValue, which lacks the ability
to delete duplicates of a key or add a new key.
Fix an == that should have been equals in ConfigBeanImpl.java
Fix missing equals/hashCode on IgnoredWhitespace token
Add some `<?>` that Xlint:unchecked wanted
Make RenderComparator serializable just to silence findbugs
findbugs still reports some "serializable without void
constructors" but those are not accurate because we replace
the instance with another class before serializing.
At present, we don't make a file() include relative to the
file doing the including. This is discussed in #202.
We should most likely change this behavior, but this
commit documents and tests it.