Commit Graph

804 Commits

Author SHA1 Message Date
Havoc Pennington
18e30353fd Fix bad html in hasPathOrNull doc comment 2015-03-24 13:44:05 -04:00
Havoc Pennington
92dc50ea0a Add Config.hasPathOrNull and Config.getIsNull
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.
2015-03-24 13:44:05 -04:00
Havoc Pennington
25a9f91230 Merge pull request #280 from fpringvaldsen/task/create-ConfigNode
Add ConfigDocument API
2015-03-24 13:37:01 -04:00
Preben Ingvaldsen
b70d4c1fc9 Update single value parsing
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.
2015-03-24 10:15:50 -07:00
Preben Ingvaldsen
1639a91481 Address further PR feedback before merge
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.
2015-03-23 15:55:38 -07:00
Preben Ingvaldsen
c3a2e07c6a Address some more PR feedback
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.
2015-03-23 14:02:59 -07:00
Havoc Pennington
e8c51c4654 Merge pull request #285 from glenford/master
Add Beamly clojure wrapper to the README
2015-03-23 13:41:11 -04:00
Preben Ingvaldsen
28a096f157 Cleanup based on findbugs 2015-03-20 14:09:17 -07:00
Glen Ford
92a87dbc4f Add Beamly clojure wrapper to the README 2015-03-20 08:37:06 +00:00
Preben Ingvaldsen
4b61790fb4 Improve field addition in node replacement
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.
2015-03-19 16:28:32 -07:00
Preben Ingvaldsen
639a3eae5b Add ConfigDocument tests
Add ConfigDocument tests that parse a String or a file, ensure
that the original text can be rendered, and test value
replacement.
2015-03-18 15:46:25 -07:00
Preben Ingvaldsen
c44ef1c6f7 Add new subclasses of ConfigNodeComplexValue
Add three new classes, ConfigNodeObject, ConfigNodeArray, and
ConfigNodeConcatenation, to differentiate the three types of
complex nodes. Disallow setting values outside of
ConfigNodeObjects.
2015-03-18 10:38:09 -07:00
Havoc Pennington
24c6b097cb Merge pull request #284 from jmccure/fix-hash-comment-test
Amend duplicated whitespace comment test
2015-03-17 16:54:51 -07:00
Jay McCure
1227c35ced Amend duplicated whitespace comment test 2015-03-17 20:20:21 +00:00
Preben Ingvaldsen
d3b33cc6c2 Refactor parseConcatenation() method
Refactor the parseConcatenation() method in ConfigDocumentParser
to not throw out parsed values if only one value was seen. Rename
parseConcatenation to consolidateValues().
2015-03-17 10:46:36 -07:00
Preben Ingvaldsen
f115731071 Add ConfigDocumentParser JSON tests
Add tests to ensure that the ConfigDocumentParser can parse
valid JSON, and that it throws the proper errors when parsing
invalid JSON.
2015-03-16 15:43:24 -07:00
Preben Ingvaldsen
4101f942d2 Create ConfigDocumentParser
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.
2015-03-16 15:43:16 -07:00
Preben Ingvaldsen
2e6bc40490 Address further PR feedback
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
2015-03-12 11:23:06 -07:00
Preben Ingvaldsen
b19e38f29b Extract Path parsing into new class
Extract the logic to parse a Path out of the Parser and into
a new PathParser class.
2015-03-11 13:59:57 -07:00
Preben Ingvaldsen
0a804deff5 Add docs and copyright information
Add copyright information to all ConfigNode classes. Document
the ConfigNode interface.
2015-03-11 13:35:06 -07:00
Preben Ingvaldsen
cce8c204ac Keep tokens in Path
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.
2015-03-11 11:27:28 -07:00
Preben Ingvaldsen
e695543bf1 Address ConfigNode PR feedback
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
2015-03-11 09:41:32 -07:00
Preben Ingvaldsen
3166db4d72 Add more robust ConfigNode tests
Add more robust tests for ConfigNode classes. Add tests to
test arrays, duplicate removal, and addition of non-existent
paths.
2015-03-10 13:55:46 -07:00
Preben Ingvaldsen
fa0aaeabbf Add path to ConfigNodeComplexValue if nonexistent
Add the desired path passed into the setValueOnPath method in
ConfigNodeComplexValue if that path does not exist in the node.
2015-03-10 09:25:02 -07:00
Preben Ingvaldsen
faf8d42a6c Remove repeats when setting value in ConfigNode
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.
2015-03-10 09:23:08 -07:00
Preben Ingvaldsen
13f2cb3f46 Add ConfigNode classes
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.
2015-03-10 09:23:08 -07:00
Havoc Pennington
7511e865a5 Update findbugs, add Xlint:unchecked, fix warnings discovered
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.
2015-03-09 16:55:07 -04:00
Havoc Pennington
d73d11edb2 Remove unused import in Parseable.java 2015-03-09 16:33:10 -04:00
Havoc Pennington
41b6193261 Add missing since tags and other minor doc cleanups
Fixes #278
2015-03-09 13:00:27 -04:00
Havoc Pennington
79fc367685 Update doctoc for README.md and add doctoc to HOCON.md 2015-03-07 16:41:02 -05:00
Havoc Pennington
269ce0cfce Release notes for 1.3.0-M1 2015-03-06 23:51:40 -05:00
Havoc Pennington
4789ca18f0 Merge pull request #277 from typesafehub/file-relative
Test and document current behavior of file() includes
2015-03-06 22:10:27 -05:00
Havoc Pennington
8c310ef5e8 Test and document current behavior of file() includes
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.
2015-03-06 21:34:35 -05:00
Havoc Pennington
f2ce57af42 Add a test that we search classpath for heuristic include
(heuristic include means no classpath()/file()/url() around it)
2015-03-06 21:27:50 -05:00
Havoc Pennington
b7325ec636 Add some handy TestUtils to create scratch files 2015-03-06 21:27:31 -05:00
Havoc Pennington
4b2fc5c6cb Merge pull request #276 from typesafehub/javadoc
Various javadoc fixes
2015-03-06 20:32:57 -05:00
Havoc Pennington
3547ace892 Use same sbt command line for test and doc
This makes Travis complete much more quickly.
2015-03-06 20:27:35 -05:00
Havoc Pennington
59a7c00725 Add checkstyle to find missing docs, fix missing docs 2015-03-06 20:17:39 -05:00
Havoc Pennington
7914406ebf ConfigParseOptions prependIncluder/appendIncluder throw NPE on null includer
Previously they would silently allow null only some of the time,
which would conceal bugs.
2015-03-06 20:09:11 -05:00
Havoc Pennington
be2f09a156 Run 'doc' in Travis 2015-03-06 13:57:06 -05:00
Havoc Pennington
332d696dcf Bump the base version to 1.3.0 representing next release 2015-03-06 13:53:06 -05:00
Havoc Pennington
adf0634c15 Stick the version number in the docs overview 2015-03-06 13:37:55 -05:00
Havoc Pennington
730d744753 Add javadoc source links that go to github 2015-03-06 13:34:28 -05:00
Havoc Pennington
77ca7a427c Fix all the javadoc warnings
For broken doc comments in impl, just deleted them for
the most part rather than writing a bunch of useless docs.
"impl" is now included in the docs because javadoc 8 seems
to explode otherwise, but it's well-labeled as internal ABI.
2015-03-06 11:38:07 -05:00
Havoc Pennington
5e0be760c7 Merge pull request #275 from typesafehub/serialized-config-tostring
Implement non-exploding toString/equals/hashCode on SerializedConfigValu...
2015-03-06 10:00:46 -05:00
Havoc Pennington
8f4436d806 Merge pull request #274 from typesafehub/default-application
Add ConfigFactory.defaultApplication and load(parseOptions, resolveOptio...
2015-03-06 10:00:36 -05:00
Havoc Pennington
a959808070 Implement non-exploding toString/equals/hashCode on SerializedConfigValue
Fixes #176 by ensuring SerializedConfigValue implements the java.lang.Object
contract without exploding. This is a completely internal class, but
-Dsun.io.serialization.extendedDebugInfo=true calls toString on it.
2015-03-05 14:05:56 -05:00
Havoc Pennington
7d21966a3e Add ConfigFactory.defaultApplication and load(parseOptions, resolveOptions)
This is a rearrangement of ConfigFactory so that defaultApplication is public.
Also fixes a bug where we were caching the overload that takes parse and resolve
options, without putting those options in the cache key. Moved to only cache
the actual default config (the one that doesn't take any options).

Fixes #196 plus the separate bug about bad caching.
2015-03-05 13:49:51 -05:00
Havoc Pennington
cf84e26ddd Merge pull request #273 from typesafehub/404-url
Treat 404 from a URL as missing file, not fatal error
2015-03-05 11:42:04 -05:00
Havoc Pennington
52ba150a9a Add HttpTest for testing URL parsing and error handling 2015-03-04 21:16:41 -05:00