Commit Graph

390 Commits

Author SHA1 Message Date
Jake Wharton
360006b7bf Add writer value overload for boxed booleans.
Autoboxing resolves boxed longs and doubles to value(Number), but a boxed boolean would otherwise resolve to value(boolean) with an implicit call to booleanValue() which has the potential to throw NPEs.
2016-04-29 17:16:52 -04:00
jwilson
13ec26a96d Be more aggressive about canonicalizing types.
Unfortunately we shouldn't be relying on equals() and hashCode() of the
default implementations anywhere.
2016-04-24 10:05:03 -04:00
Tomas Kotula
739efea61d Workaround for Android ParameterizedType implementation bug 2016-04-24 09:22:50 -04:00
Jake Wharton
c5d406592d Merge pull request #156 from square/jwilson_0423_track_options_api
Track Okio snapshot API change to Options.
2016-04-23 23:34:41 -04:00
Jesse Wilson
d7bd016614 Merge pull request #149 from xizzhu/support-gingerbread
Added support for pre-Gingerbread.
2016-04-23 23:24:00 -04:00
jwilson
20a64dff7e Track Okio snapshot API change to Options.
Also rename our own Selection class to Options since it's semantically
the same thing.

https://github.com/square/okio/pull/215
2016-04-23 23:20:39 -04:00
jwilson
4925755ffa Optimize reading one of several expected values with Selection
This isn't yet public API.

This relies on an unreleased Okio API.

This has a significant impact on performance. I measured parsing performance
improve from 89k ops/sec to 140k ops/sec on one benchmark.
2016-04-17 20:15:07 -10:00
Xizhi Zhu
5ec289ff9d Added support for pre-Gingerbread. 2016-04-08 14:29:13 +03:00
jwilson
69f4a96d5e Small optimizations to JSON parsing.
Prefer LinkedHashMap for maps that will be queried heavily.

Inline a single-line method to refill the buffer.
2016-04-06 00:39:04 -04:00
Jake Wharton
827f89adc8 Merge pull request #139 from square/jwilson_0313_promote_unquoted_keys
Confirm Moshi can handle unquoted numeric keys.
2016-03-13 16:01:38 -04:00
jwilson
41730edd4d Confirm Moshi can handle unquoted numeric keys.
See also https://github.com/google/gson/pull/809/files
2016-03-13 15:53:23 -04:00
Jesse Wilson
33e1fb1bb5 Merge pull request #127 from square/jw/redundant
Remove redundant loop variable.
2016-01-21 16:46:43 -05:00
Jake Wharton
82e70e9cce Remove redundant loop variable. 2016-01-21 11:16:09 -05:00
Jake Wharton
dc154c733a Missing @Override annotations. 2016-01-21 11:15:34 -05:00
Jesse Wilson
b8e6dc403e Merge pull request #125 from square/jw/iface-and-impl
Break apart Okio-based JSON reader and writer.
2016-01-21 10:17:08 -05:00
Jake Wharton
1071cec7d1 Break apart Okio-based JSON reader and writer. 2016-01-20 23:43:05 -05:00
jwilson
ad3506ffed [maven-release-plugin] prepare for next development iteration 2016-01-18 17:17:10 -05:00
jwilson
30a4c3c92e [maven-release-plugin] prepare release moshi-parent-1.1.0 2016-01-18 17:17:08 -05:00
jwilson
324a59e0c9 Use an array indexed by ordinal to go from enum to name. 2016-01-18 16:57:07 -05:00
Jesse Wilson
8a5c0f387b Merge pull request #119 from serj-lotutovici/sl/json_for_enums
Enable Json annotation for enum values.
2016-01-18 16:52:02 -05:00
Jake Wharton
97d2bf5e66 Update reader and writer to RFC 7159. 2016-01-18 00:54:54 -05:00
Serj Lotutovici
d1b1def4a1 Enable Json annotation for enum values. 2016-01-08 00:16:59 +01:00
Jake Wharton
6b945e5df7 Remove creation of synthetic accessor methods. 2015-12-22 02:45:31 -05:00
Phelipe Alves de Souza
86c9c6cbfa Increasing the code coverage of AdapterMethodsFactory 2015-11-04 19:55:35 -05:00
Prateek Srivastava
28d758d62b Presize Lists
Avoids unnecessary work due to growing the list.
2015-11-01 11:10:05 -08:00
Serj Lotutovici
ee01275c76 Create new builder from Moshi instance 2015-10-21 12:01:43 +02:00
edwardaa
04be7b8ec6 Doc fix for JsonWriter.serializeNulls 2015-10-03 15:20:59 +08:00
David Mihola
7970c36893 Make two methods on Types public.
To facilitate custom JsonAdapter.Factory implementations.
2015-09-29 10:44:41 +02:00
jwilson
e6a77041a1 [maven-release-plugin] prepare for next development iteration 2015-09-27 13:25:21 -04:00
jwilson
e93e6574ca [maven-release-plugin] prepare release moshi-parent-1.0.0 2015-09-27 13:25:18 -04:00
jwilson
e181db0015 JsonReader.of() and JsonWriter.of() instead of constructors.
This opens the door to later implementations of these types that write
to something other than a stream. In particular, we could have a
JsonReader that reads from a DOM-like object, or a JsonWriter that
creates such an object.
2015-09-27 12:09:32 -04:00
jwilson
f7b09188a8 Audit @link for should-be @linkplain uses.
Closes https://github.com/square/moshi/issues/37
2015-09-27 11:27:55 -04:00
jwilson
9d9f12f808 Adapter caching, plus other ergonomic features.
This adds a toString() to most adapters. The format isn't perfect, but
it should make step-debugging easier.

Define the precedence order of adapter factories.

Forbid registering adapters with annotation literals if those annotations
need values to be provided.
2015-09-26 15:18:48 -04:00
Serj Lotutovici
80953219bd ObjectJsonAdapter should not fail on null values.
Closes #79
2015-09-17 09:46:00 +02:00
jwilson
a167913e5d Make four methods on Types public.
Not Moshi's responsibility, but pragmatic.

Closes https://github.com/square/moshi/issues/73
2015-08-21 00:02:07 -04:00
Ryan Harter
8d575b3c51 Adds method scope to Json annotation for use with AutoValue. 2015-08-17 10:30:27 -05:00
Jake Wharton
4b76bb9526 Throw a better message attempting to adapt a platform type. 2015-08-08 20:29:27 -04:00
jwilson
97fc14616d New APIs to reject unknown values. 2015-08-02 23:27:16 -04:00
jwilson
7890effcee New @Json annotation to customize a field's name. 2015-08-02 23:14:04 -04:00
jwilson
d87bf52053 Nicer failure messages on partial adapters.
Closes https://github.com/square/moshi/issues/59
2015-06-21 15:32:27 -04:00
Dave Roberge
0ce7310caa Update JsonReader & JsonWriter javadoc to use BufferedSource & BufferedSink 2015-06-20 09:46:24 -04:00
Jesse Wilson
41ec6118fe Merge pull request #57 from square/jw/no-io
There is no I/O writing to a Buffer.
2015-06-17 10:11:38 -04:00
Jake Wharton
a25508a85e There is no I/O writing to a Buffer. 2015-06-17 00:16:03 -04:00
jwilson
c9b2dbe395 [maven-release-plugin] prepare for next development iteration 2015-06-16 07:45:59 -04:00
jwilson
46a8a880e9 [maven-release-plugin] prepare release moshi-parent-0.9.0 2015-06-16 07:45:57 -04:00
jwilson
d01c5782c3 Initial round of Moshi docs. 2015-06-16 07:35:41 -04:00
jwilson
a3520730a0 New magic API to use type adapters for map keys. 2015-06-14 23:58:16 -04:00
Jake Wharton
a69c32741e Merge pull request #52 from square/jwilson_0613_object_adapter
Runtime type adapter.
2015-06-14 17:51:49 -04:00
jwilson
bb31ba18ca Runtime type adapter.
Closes https://github.com/square/moshi/issues/27
2015-06-13 13:06:09 -04:00
Jake Wharton
707f33226c Merge pull request #51 from square/jwilson_0609_jsonwriter_getpath
JsonWriter.getPath().
2015-06-09 23:22:48 -04:00