Commit Graph

18 Commits

Author SHA1 Message Date
Marcono1234 4dda4ec5ba
Use diamond operator when creating generic instances (#2104) 2022-04-17 15:27:21 -07:00
Lyubomyr Shaydariv fe30b85224
Support arbitrary Number implementation for Object and Number deserialization (#1290)
* Object and Number type adapters number deserialization can be configured

* Change wording of ToNumberStrategy documentation

* Use inline links in doc sparingly

If the element has already been linked before, don't create a link for
every subsequent occurrence.

See also (slightly dated)
https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#inlinelinks

* Link to default to-number policies in ToNumberStrategy doc

* Reduce code duplication for deserializing Number

* Hide default factory constants of NumberTypeAdapter and ObjectTypeAdapter

This encapsulates the logic a little bit better.
Additionally refactored factory created by NumberTypeAdapter to only create
TypeAdapter once and then have factory reuse that adapter for better
performance.

Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
2021-10-08 17:09:43 -07:00
Jake Wharton 7a1c94f986 Remove synthetic accessors from being generated. 2015-12-27 01:39:19 -05:00
Inderjeet Singh e5b3f6368d updated minimum JDK version to 1.6.
Added Overrides for methods implementing an interface.
2015-11-04 18:52:20 -08:00
Joel Leitch f29d5bc37b Create a LinkedTreeMap based on the LinkedHashTreeMap; however, removed all the hashing from it as resorted to a single tree. The insertion order is still preserved. 2013-05-03 16:11:16 +00:00
Inderjeet Singh ae034b5ca2 eliminated eclipse warnings by adding a default label to switch. 2013-04-12 20:14:50 +00:00
Joel Leitch af6aa5f782 Use the LinkedHashTreeMap instead of LinkedTreeMap and delete the LinkedTreeMap version. 2013-04-04 21:31:23 +00:00
Joel Leitch 14f16e2d0c Adding Red-Black Tree implementation and tying it into the Gson bindings. 2012-10-11 03:15:49 +00:00
Jesse Wilson 4c629347da Only support string keys in string map. This rev passed all 655 applicable map tests in the Guava collections test suite. 2012-03-11 17:34:46 +00:00
Jesse Wilson 751c69c655 Support null values in StringMap 2012-03-11 15:19:01 +00:00
Jesse Wilson ad3489f557 First steps to StringMap, an alternative to LinkedHashmap. 2012-03-11 13:54:41 +00:00
Jesse Wilson d7fbac0384 Rename TypeAdapter.Factory to TypeAdapterFactory. 2011-12-23 18:27:13 +00:00
Jesse Wilson f602bce9f5 Nice documentation for TypeAdapter. 2011-12-03 19:46:25 +00:00
Jesse Wilson 26ab404599 Cleanup names for TypeAdapters. 2011-12-02 22:57:30 +00:00
Jesse Wilson f777a192ee Remove dead code and fold contents of single-member helper classes into their clients. 2011-11-20 21:02:26 +00:00
Jesse Wilson 7e760143fd Smash together MiniGson and Gson. This changes Gson to be the MiniGson rather than delegating to the MiniGson. It means that the MiniGson objects passed into streaming type adapters are now fully-capable 'Gson' objects.
The most notable impact of this change is that it adds several new public APIs:
 - The TypeAdapter abstract class
 - The TypeAdapter.Factory interface
 - Four new methods on GsonBuilder to register streaming TypeAdapters (via Factory, via Class, via TypeToken, and as a type hierarchy)
 - Three new methods on Gson to lookup streaming TypeAdapters (by type, by class, and to get the next type adapter) 

Still outstanding:
 - Write beautiful prose to document the new APIs above
 - Change GsonBuilder's precedence so that both old and new-style type adapters are registered in one lot
2011-11-20 15:23:08 +00:00
Inderjeet Singh ea9c0236c7 Converted InetAddress type adapter to new style. 2011-09-09 04:02:12 +00:00
Jesse Wilson 3aeb70e030 Adapter for Object.class 2011-09-09 03:31:16 +00:00