Commit Graph

26 Commits

Author SHA1 Message Date
Marcono1234
2591ede59b
Fix incorrect HTML headings in Javadoc (#2200) 2022-09-24 17:02:11 -07:00
Éamonn McManus
0864a02e86
Build on JDK 17 as well as 11. (#2198)
* Build on JDK 8 and 17 as well as 11.

* Remove JDK 8 for now.

`DefaultDateTypeAdapterTest` fails.

* Tweak javadoc to avoid warnings.

Mostly these are about using `<h3>` when the previous tag was `<h1>`,
and the like. This previous tag might be implicit (part of what javadoc
itself outputs rather than the HTML in doc comments).

Apparently JDK 11 puts method javadoc inside `<h2>` while JDK 11 puts it
inside `<h3>`. Or something like that. Anyway it doesn't appear to be
possible to use `<h3>` _or_ `<h4>` and please both.
2022-09-23 14:33:28 -07:00
Marcono1234
6fc1c8f7f1
Fix TypeAdapter.toJson throwing AssertionError for custom IOException (#2172)
* Fix TypeAdapter.toJson throwing AssertionError for custom IOException

* Add throws javadoc tag for TypeAdapter methods
2022-08-08 08:19:44 -07:00
Marcono1234
cbc0af867b
Improve lenient mode documentation (#2122) 2022-06-28 09:48:05 -07:00
Jake Wharton
032847976c There is no I/O writing to a StringWriter. 2015-06-17 22:01:17 -04:00
Jesse Wilson
323dfa0af5 Be strict in TypeAdapter's toJson/fromJson methods 2012-01-01 12:36:42 +00:00
Inderjeet Singh
6c78bf5247 made toJson/fromJson/toJsonTree methods public in TypeAdapter.
made Gson.getNextAdapter method public.
2011-12-31 08:52:59 +00:00
Jesse Wilson
ecdf9150f6 Hide Gson.getNextAdapter() for the current release. 2011-12-31 05:30:40 +00:00
Jesse Wilson
4057b98bab Implement all but the most difficult part of graph type adapter's deserialization. The catch is we want to return an instance that we don't have yet. It's on the stack, but we don't have a handle to it because it's inside the 'nextTypeAdapter' who is busy populating its fields. 2011-12-30 08:27:24 +00:00
Jesse Wilson
d7fbac0384 Rename TypeAdapter.Factory to TypeAdapterFactory. 2011-12-23 18:27:13 +00:00
Jesse Wilson
b28e518c7e Hide toJson/fromJson APIs for the 2.1 release. 2011-12-21 21:30:18 +00:00
Jesse Wilson
f24da51ca2 Fix dangling sentence. 2011-12-16 19:00:37 +00:00
Jesse Wilson
2ef7716209 Fix a broken Javadoc link to this. 2011-12-16 05:38:16 +00:00
Jesse Wilson
eb2230caf0 Fix nullSafe() to not infinitely recurse on non-null input. 2011-12-06 15:35:52 +00:00
Inderjeet Singh
b19e187bdd Minor improvements to TypeAdapter javadocs to promote the use of nullSafe. 2011-12-06 08:32:19 +00:00
Inderjeet Singh
0b734e46e1 Incorporated code review comments from r1061.
Made nullSafe() an instance method instead of a static method.
Updated code javadoc to match Guava style.
2011-12-06 08:18:00 +00:00
Jesse Wilson
296d843afd Implement Inder's improvements on the TypeAdapter docs 2011-12-06 04:56:46 +00:00
Inderjeet Singh
91be944022 Added a new API method nullSafe() in TypeAdapter that can be used to avoid boilerplate handling of nulls in a type adapter. 2011-12-05 19:50:49 +00:00
Jesse Wilson
f602bce9f5 Nice documentation for TypeAdapter. 2011-12-03 19:46:25 +00:00
Inderjeet Singh
8ee2c24f61 renamed JsonElementReader to JsonTreeReader 2011-12-03 02:37:27 +00:00
Jesse Wilson
8f8e69a364 Add @since tags. 2011-12-02 23:11:28 +00:00
Jesse Wilson
26ab404599 Cleanup names for TypeAdapters. 2011-12-02 22:57:30 +00:00
Inderjeet Singh
ddde79c861 Added a deepCopy() method in GsonBuilder. This allows a web-service to create a pre-configured GsonBuilder and then for each request, create a Gson instance by adding type adapters to a copy.
In TypeAdapter.Factory.create() method, using the term gson to refer to the Gson instance instead of a little ambiguous context.
2011-11-25 05:40:17 +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
Jesse Wilson
d1ddab2e6f Swap out GSON's type mechanics with the Type resolution code from Guice.
The most significant impact of this change is that fields whose types are type parameters should now GSONify just fine. For example, consider the class below.

abstract class Foo<A, B> {
   A a;
   B b;
   List<A> list;
   Map<A, List<B>> map;
}
class RealFoo extends Foo<String, Integer> {...}

This is a reasonable checkpoint but some work still needs to be done for this. In particular, the level of visibility of methods in TypeToken and Type should be reconsidered; we're exposing more than we need to!
2010-12-03 08:07:13 +00:00
Inderjeet Singh
57d1f32de5 moved gson as a project under trunk 2008-09-01 03:13:32 +00:00