Commit Graph

689 Commits

Author SHA1 Message Date
Havoc Pennington
a528bf104a Properly track resource file origins
This improves error messages to fix #254.
2015-03-02 15:26:49 -05:00
Havoc Pennington
988c3441aa Apply numeric sort to object keys when rendering
Fixes #228 reported by @derrickburns; since we can interpret
numeric keys as lists, we sort the keys numerically to make
it easy to read the list value in order.
2015-03-02 11:31:32 -05:00
Havoc Pennington
55bd472c24 Improve ConfigBeanFactory docs in README 2015-03-02 11:03:38 -05:00
Havoc Pennington
c1a7ce0333 Mention ConfigBeanFactory in the README 2015-03-02 11:02:11 -05:00
Havoc Pennington
edd4f14c99 Merge pull request #264 from typesafehub/beanfactory
Add ConfigBeanFactory
2015-03-02 10:01:03 -05:00
Havoc Pennington
483f7a87f7 ConfigBeanImpl.java: split up too-long getValue method 2015-03-02 09:53:13 -05:00
Havoc Pennington
e522071442 toCamelCase doesn't need to be public anymore 2015-03-02 09:45:44 -05:00
Havoc Pennington
b692e988a6 ConfigBeanFactory: comprehensively list allowed types
We want to avoid ever getting a ClassCastException, instead we
want a more helpful error. So write out all types explicitly.
This also will make it easier to ensure that tests are
comprehensive, and this commit adds a lot more tests.
This commit now supports typesafe List<T>, and allows you
to have fields of type Object, ConfigObject, Config, ConfigValue,
and Map<String,Object>, so if you want to accept "anything" you
can do that by specifying a vague type and then casting it yourself.
2015-03-02 09:45:39 -05:00
Havoc Pennington
26eec7be90 If a bean sees foo-bar and fooBar, prefer camel name 2015-03-02 09:45:32 -05:00
Havoc Pennington
4c9d5aae4f Remove Byte and Short support from beans for now
The right way to do these would be analogous to getInt, that is,
with a getter on Config that checks the range and throws the
right exception if the range is incorrect. But, I hesitate to
add getByte, getShort, getByteList, getShortList all to Config,
since they don't seem super useful. If we do want them though,
they should be added to beans and to Config at the same time,
so they are completely parallel to how Integer and Long work.
2015-03-02 09:45:26 -05:00
Havoc Pennington
82fcfe3f5a ConfigBeanFactory: validate against bean's implied schema
The advantage of this is that rather than throwing a single
"ConfigException.Missing" we can give the user a list of all
missing and wrong-typed settings for the entire bean up front.

Validation is not perfect (just as the regular checkValid method
isn't, it doesn't find all problems that actually getting the
value could find), but it does find the common cases of leaving
out a setting or having a blatantly incorrect type.
2015-03-02 09:45:20 -05:00
Havoc Pennington
11efe879e8 Move ConfigBeanFactory internals to impl.ConfigBeanImpl
This is because I want to make some changes that will use
impl-private API.
2015-03-02 09:45:13 -05:00
Havoc Pennington
49dcdcae20 Be sure we test putting hyphen names in bean props 2015-03-02 09:45:08 -05:00
Havoc Pennington
fe385cca06 Test that toCamelCase leaves already-camel-case stuff unchanged 2015-03-02 09:45:04 -05:00
Havoc Pennington
4aab07983f Avoid ConfigException.Generic in ConfigBeanFactory 2015-03-02 09:45:00 -05:00
Havoc Pennington
7255941bfc Tweak the ConfigBeanFactory javadoc a bit 2015-03-02 09:44:55 -05:00
Havoc Pennington
3681e5d427 Move ConfigBeanFactorTest and toCamelCase into the impl package 2015-03-02 09:44:47 -05:00
Havoc Pennington
7a74183190 Expand ConfigBeanFactory test coverage to all the primitive types. 2015-03-02 09:44:42 -05:00
Havoc Pennington
14dbe09199 Move to jacoco 2.1.6 which works with Java 8 2015-03-02 09:44:36 -05:00
Havoc Pennington
69f7b48130 Change ConfigBeanFactory to use ConfigMemorySize and java.time.Duration 2015-03-02 09:44:17 -05:00
Andrey Zaytsev
f1f198595a Second cut at ConfigBeanFactory
This version predates ConfigMemorySize and java.time.Duration
support.
2015-03-02 09:43:31 -05:00
Ben McCann
d4a0255520 add first cut at BeanFactory 2015-03-02 09:41:46 -05:00
Havoc Pennington
b44eae9f11 Merge pull request #262 from typesafehub/windows-quoting
Properly quote filenames in tests, to attempt to fix Windows
2015-02-26 12:18:22 -05:00
Havoc Pennington
cb5eb350cc Properly quote filenames in tests, to attempt to fix Windows
Reported by @Johnlon via PR #201
2015-02-26 12:12:18 -05:00
Havoc Pennington
191ca2657d Merge pull request #261 from typesafehub/from-anyref-value
Support fromAnyRef(ConfigValue)
2015-02-26 09:43:05 -05:00
Havoc Pennington
db5e95c457 Fix ConfigMemorySizeTest.scala indentation 2015-02-26 09:17:41 -05:00
Havoc Pennington
749b28d6eb Add docs and tests for fromAnyRef handling ConfigValue 2015-02-26 09:16:57 -05:00
verbeto
b81a45870d Make fromAnyRef return a ConfigValue unmodified instead of throwing 2015-02-26 09:02:00 -05:00
Havoc Pennington
a73fe1f1e9 Merge pull request #257 from typesafehub/duration
Support java.time.Duration getters on Config
2015-02-26 08:55:48 -05:00
Havoc Pennington
0e722a10cd Merge pull request #260 from typesafehub/newlines-in-description
In render, put comment char in front of every description line
2015-02-26 08:52:08 -05:00
Havoc Pennington
2028cff9f6 Merge pull request #258 from typesafehub/scalariform
Scalariform the tests, discovering a bug in the process
2015-02-26 08:51:57 -05:00
Havoc Pennington
dddcd0443a Support java.time.Duration getters on Config
Also support fromAnyRef on a Duration
2015-02-26 08:51:34 -05:00
Havoc Pennington
cd634decc5 Merge pull request #256 from typesafehub/config-memory-size
add ConfigMemorySize and getters for it
2015-02-26 08:50:03 -05:00
Havoc Pennington
9c2daf8c0f In render, put comment char in front of every description line
Fixes #239 that multiline descriptions created unparseable output.
2015-02-26 00:10:11 -05:00
Havoc Pennington
f1530e64c5 Add scalariform to the build, to format the Scala tests 2015-02-25 23:37:50 -05:00
Havoc Pennington
9348bf2132 Fix Path.render to avoid quoting elements starting with number char
This was supposed to be done earlier, but the test for it wasn't
actually being run - it looked like it was in a list due to
indentation, but in fact was not in the list. So Scalariform
revealed the bug.
2015-02-25 23:36:23 -05:00
Havoc Pennington
51f05d9927 Add since 1.3.0 tags to the new ConfigMemorySize methods 2015-02-25 21:25:31 -05:00
Havoc Pennington
97718593c6 Support ConfigMemorySize in fromAnyRef
We don't preserve its "memory-size-ness" but we can parse
it into a Long.
2015-02-25 21:01:09 -05:00
Havoc Pennington
2e43d9b21c Add ConfigMemorySize.toString 2015-02-25 20:53:34 -05:00
Havoc Pennington
5a2b0b7380 Better format javadoc in ConfigMemorySize.java 2015-02-25 20:46:01 -05:00
Havoc Pennington
9d16f3bf61 Merge pull request #255 from typesafehub/java8
Switch to Java 8
2015-02-25 20:41:41 -05:00
Havoc Pennington
e72decad92 Use -source 1.6 for now, to avoid Java 8 syntactic sugar
We will still be able to use library types, but will keep
it a little easier to make a Java 7 branch this way.
2015-02-25 20:37:01 -05:00
Havoc Pennington
5b2519863e Add getMemorySize and getMemorySizeList to Config 2015-02-24 20:21:03 -05:00
Havoc Pennington
287e927129 Add ConfigMemorySize type
Not used at all yet, and with no unit conversions supported.
2015-02-24 20:20:18 -05:00
Havoc Pennington
4822a44911 Update Java version information in the README 2015-02-24 16:26:54 -05:00
Havoc Pennington
90ab6b6c12 Change expected results of hash-order-dependent tests
The spec already documents that these cases had undefined
behavior, so the tests were wrong and Java 8 broke them.
The tests are now still wrong, but have a comment that
should make it easier to understand what's happening next
time Java's hash table order changes.
2015-02-24 16:18:31 -05:00
Havoc Pennington
711fb504cb Update serialization tests for Java 8 2015-02-24 15:55:21 -05:00
Havoc Pennington
0c229be607 Enforce that the build uses Java 8 2015-02-24 15:41:31 -05:00
Ben McCann
f2aec60ff9 Only build with Java 8 on Travis
Java 7 is EOL in April and will no longer be receiving updates. Akka is dropping Java 7 support in version 2.4. Play has also decided to drop support for Java 7 in Play 2.4. Supporting Java 8 would be nice because it would allow us to do autoconversions to the new time API like java.time.Duration
2015-02-24 15:21:07 -05:00
Havoc Pennington
1f50c19b59 Formatting chat room link 2015-02-09 09:15:29 -05:00