Commit Graph

664 Commits

Author SHA1 Message Date
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
Havoc Pennington
e3f478cabc Scalariform TokenizerTest.scala 2015-03-04 21:12:38 -05:00
Pavel Yakunin
7f19e46d1c Treat 404 from a URL as missing file, not fatal error 2015-03-04 13:53:12 -05:00
Havoc Pennington
f3e11bc583 Merge pull request #271 from fpringvaldsen/feature/lossless-tokens
Add lossless tokens
2015-03-04 13:29:20 -05:00
Preben Ingvaldsen
cb86fb136e Cleanup lossless tokens code based on feedback
Clean up the lossless tokens code based on feedback.
  * Change nextTokenFromIterator() method to
    nextTokenIgnoringWhitespace()
  * Use StringBuilder in Tokenizer.render()
  * Extract Whitespace token creation into a
    `createWhitespaceTokenFromSaver` method
  * Add DoubleSlashComment and HashComment subclasses of
    Comment. Make Comment abstract.
  * Make `tokenText()` method virtual and overload it in
    subclasses that derive their original token text entirely
    from other fields.
  * Use `tokenizerTest` method in all relevant Tokenizer tests
  * Add extra multi-line comment Tokenizer tests
2015-03-03 15:27:41 -08:00
Preben Ingvaldsen
2b1c7ef13d Add lossless comment tokens
Preserve the original text of comments in comment tokens so they
can be reproduced by the TokenIterator's render() method.
2015-03-03 11:55:36 -08:00
Preben Ingvaldsen
574f810a0f Add lossless tokens minus comments
Keep the original text of all tokens when Tokenizing a config
minus comments. Add a render method to the TokenIterator class
which generates the original text from which the tokens were
parsed.
2015-03-03 11:54:30 -08:00
Havoc Pennington
fda341b44f Merge pull request #270 from typesafehub/accept-header
Set Accept header on url connections
2015-03-03 12:44:34 -05:00
Havoc Pennington
d4125f217b Set Accept header on URL connections
This fixes #182 in theory, though test coverage is nonexistent.
2015-03-03 11:02:37 -05:00
Havoc Pennington
d1918a2068 Add symbolic names for content types 2015-03-03 11:02:33 -05:00
Havoc Pennington
600e788bea Merge pull request #269 from typesafehub/doc-integer-narrowing
Document double-to-int behavior, fixes #183
2015-03-03 10:59:28 -05:00
Havoc Pennington
7a4d6c8446 Merge pull request #268 from typesafehub/whitespace-in-concat
Allow unquoted whitespace between substitutions that expand to objects/l...
2015-03-03 10:59:15 -05:00
Havoc Pennington
2874f9274b Merge pull request #267 from typesafehub/resource-origins
Properly track resource file origins
2015-03-03 10:58:50 -05:00
Havoc Pennington
0783ad341a Merge pull request #266 from typesafehub/sorted-rendering
Apply numeric sort to object keys when rendering
2015-03-03 10:58:32 -05:00
Havoc Pennington
d57b0c093d Document double-to-int behavior, fixes #183 2015-03-02 16:38:19 -05:00
Havoc Pennington
2df7b6b419 Allow unquoted whitespace between substitutions that expand to objects/lists
Fixes #212 that object and list substitutions could not have
whitespace in between.

This patch carries quoted-ness into ConfigString, which is somewhat
bogus, and we may be able to clean it up later if we start to track
the tokens that each value originates from.
2015-03-02 16:11:51 -05:00
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