Commit Graph

265 Commits

Author SHA1 Message Date
Havoc Pennington
795579f952 use SimpleConfigObject.empty() in one more spot 2011-11-12 08:39:13 -05:00
Havoc Pennington
c18f10c6dc Implement unquoted path keys, { foo.bar : 42 } 2011-11-12 01:42:43 -05:00
Havoc Pennington
a3128871ac allow duplicate keys in .conf with later key winning 2011-11-12 00:30:23 -05:00
Havoc Pennington
df3b3792da make resolveSubstitutions() do nothing on already-resolved objects.
This way if people resolve() gratuitously, there's no performance
issue. Also, tracking resolved state gives us the option to complain
about usage of unresolved objects.
2011-11-11 23:57:49 -05:00
Havoc Pennington
10babb5e8c rename Unresolved to Unmergeable 2011-11-11 22:58:26 -05:00
Havoc Pennington
9cf7b4d65a implement transformed() with a protected newCopy method instead of wrapper object 2011-11-11 22:28:23 -05:00
Havoc Pennington
839c588277 add a ConfigRoot type returned by load()
The point is to only support the resolve() method on the root object.
2011-11-11 22:11:57 -05:00
Havoc Pennington
529b3b1f55 completely drop "transformer" arg to ConfigObject constructors
If you want to change the transformer, use the transformed() method.
2011-11-11 17:28:00 -05:00
Havoc Pennington
8c00a97243 clean up merge() so it doesn't need origin or transformer
origin can be computed by combining origins of merged values.

transformer should be set prior to merge; probably it should
be an error to merge with mismatched transformers.
2011-11-11 17:18:26 -05:00
Havoc Pennington
8f0e6bd5f0 Make merging work properly with substitutions involved.
If we saw a ConfigSubstitution value, we would then
ignore any objects after it. But in fact, the substitution
might expand to an object, and then we would need to merge
it with the objects after it.

If we had an object and merged a substitution with it, we
were previously ignoring the substitution. But in fact,
the substitution might expand to an object, and we would
need to merge that object in.

So in both cases now we create a ConfigDelayedMerge
or ConfigDelayedMergeObject object instead.

As part of this, the merge() code was refactored to
use a withFallback() method, which is now handy
and public.
2011-11-11 16:32:24 -05:00
Havoc Pennington
b726948e4f make some classes final that can be 2011-11-11 11:03:23 -05:00
Havoc Pennington
ae2cd72eed make a bunch of fields final 2011-11-11 10:35:25 -05:00
Havoc Pennington
00241585bd add an empty README.md 2011-11-10 20:54:53 -05:00
Havoc Pennington
cc35f33cfa remove YAML spec 2011-11-10 20:53:36 -05:00
Havoc Pennington
a722d5249e add some tests for paths with hyphen and underscore in them 2011-11-10 20:52:06 -05:00
Havoc Pennington
d13f7861fd avoid full parser for simple paths
Kind of a stupid overoptimization probably but what the hell
2011-11-10 20:51:29 -05:00
Havoc Pennington
da09c9790c improve error message on badly-formatted number 2011-11-10 20:50:46 -05:00
Havoc Pennington
43337aa315 call getMilliseconds in ApiExamples.scala 2011-11-10 20:21:59 -05:00
Havoc Pennington
8ea188ed59 move unwrapped() return type specialization from AbstractConfigObject to ConfigObject 2011-11-10 20:19:26 -05:00
Havoc Pennington
f169f12d43 add an ApiExamples.scala to tests 2011-11-10 20:16:33 -05:00
Havoc Pennington
9a187a2de9 rename getAny to getAnyRef
makes it a better name in Scala
2011-11-10 20:16:04 -05:00
Havoc Pennington
3019aec77f move a ConfigList interface up into the public API 2011-11-10 19:53:02 -05:00
Havoc Pennington
88b970982d make ConfigList implement java.util.List 2011-11-10 19:36:42 -05:00
Havoc Pennington
be63b620f6 make ConfigObject implement java.util.Map<String, ConfigValue> 2011-11-10 17:00:21 -05:00
Havoc Pennington
c677a23b3b Sort map keys when computing the hash for a SimpleConfigObject 2011-11-10 16:12:40 -05:00
Havoc Pennington
6923dec829 rename resolve() to find() in AbstractConfigObject
since resolve() is being used for substitution resolution
2011-11-10 15:40:55 -05:00
Havoc Pennington
a70bb89c2a use full path parser for ConfigObject getters 2011-11-10 15:38:36 -05:00
Havoc Pennington
cfff60131e close StringReader in parsePath
not sure there's any real need but technically correct
2011-11-10 15:36:11 -05:00
Havoc Pennington
d46b068eaf reimplement Path.newPath using the full parser 2011-11-10 15:04:45 -05:00
Havoc Pennington
859dc082bd make parsePathException a static method on Parser
This is step 1 toward using it to parse keys in the API.
2011-11-10 14:48:17 -05:00
Havoc Pennington
fb2d68ff3c move newKey and newPath to Path from PathBuilder 2011-11-10 14:44:43 -05:00
Havoc Pennington
e0a49c06da Generalize path handling in substitutions
The new approach allows a mix of tokens in the substitution,
so you can refer to path elements that contain characters
that need quoting, including periods.
2011-11-10 14:42:05 -05:00
Havoc Pennington
cdcde9eebc pass an "includer" object down to the parser 2011-11-09 17:39:07 -05:00
Havoc Pennington
9509876ced add a TODO.txt to keep a few notes 2011-11-09 17:18:07 -05:00
Havoc Pennington
ecad3b31f0 move some stuff from ConfigImpl to a new class Loader
This is just to make ConfigImpl less of a random jumble.
2011-11-09 17:17:15 -05:00
Havoc Pennington
99d3c17fd0 add a bunch of small tests, fix related minor bugs
This brings code coverage up to a decent percentage
2011-11-09 16:42:58 -05:00
Havoc Pennington
0ec572c8d9 remove unused StackConfigObject and RawValueType 2011-11-09 11:11:24 -05:00
Havoc Pennington
58b19f5fa4 test and fix up the merged config object loaded from resources 2011-11-09 11:07:46 -05:00
Havoc Pennington
82586d7a02 make non-public getEnvironmentAsConfig and getSystemPropertiesAsConfig 2011-11-09 08:55:58 -05:00
Havoc Pennington
1b3d6d429f add jacoco code coverage plugin 2011-11-09 08:47:29 -05:00
Havoc Pennington
d0ac801720 various fixes suggested by findbugs 2011-11-09 00:07:43 -05:00
Havoc Pennington
cd6bf42cdc add findbugs sbt plugin 2011-11-09 00:07:21 -05:00
Havoc Pennington
2facd09341 add some more API docs 2011-11-08 22:30:08 -05:00
Havoc Pennington
84e37b3745 fix various warnings after enabling more warnings 2011-11-08 22:08:28 -05:00
Havoc Pennington
64c6c753e5 use internal AbstractConfigValue instead of public ConfigValue throughout implementation
In practice don't want to try to support custom ConfigValue.
2011-11-08 22:03:22 -05:00
Havoc Pennington
e11f117200 make ConfigTransformer private, don't think it's useful 2011-11-08 21:37:19 -05:00
Havoc Pennington
619ce047c2 fix the memory size and duration parsers
Switching to Java from Scala it's easy to get confused...
2011-11-08 21:36:49 -05:00
Havoc Pennington
c7c8c2ff14 Implement substitution in parser and config objects 2011-11-08 17:02:00 -05:00
Havoc Pennington
42b355deb1 Implement ${} substitutions in the tokenizer 2011-11-08 10:15:31 -05:00
Havoc Pennington
258449a051 use appendCodePoint(c) not append((char)c) 2011-11-08 09:19:34 -05:00