Commit Graph

179 Commits

Author SHA1 Message Date
qwwdfsad
c5611847a3 Gson synchronized map replaced with concurrent hash map 2016-03-05 00:28:25 +03:00
Dongjoon Hyun
aa209fa255 Fix some typos in gson comments. 2016-02-15 14:11:23 -08:00
Jake Wharton
3360c93a76 Add setting for leniency on Gson instance.
Add a JsonReader factory (for parity with the JsonWriter one) which provides a configured instance using the Gson settings.
2016-01-18 12:08:11 -05:00
Jake Wharton
7a1c94f986 Remove synthetic accessors from being generated. 2015-12-27 01:39:19 -05:00
Inderjeet Singh
47cc34548d added currency class 2015-11-06 15:41:15 -08:00
Inderjeet Singh
11b26b5256 Added support for AtomicLongArray.
Also added tests to ensure LongSerializationPolicy is honored.
2015-11-05 14:15:46 -08:00
Inderjeet Singh
caef762530 added factory fields for consistency 2015-11-05 14:03:51 -08:00
Inderjeet Singh
cc54e4dbdd made methods static 2015-11-05 10:46:54 -08:00
Inderjeet Singh
7821b73202 Added support for AtomicInteger, AtomicBoolean, AtomicLong and AtomicIntegerArray. 2015-11-05 10:45:23 -08: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
Jake Wharton
e81f3eba27 Expose newJsonWriter wrapper instead of just options.
This is more future proof to ensure that consumers holding on to TypeAdapters for efficiency can always encode JSON in the same way as if the Gson instance was used directly.
2015-09-26 19:19:38 -04:00
Jake Wharton
31f80d8659 Merge pull request #700 from google/jwilson_0907_serializenulls_accessor
Expose serializeNulls with an accessor.
2015-09-07 22:44:05 -04:00
jwilson
ff2c8f8e8b Expose serializeNulls with an accessor.
Useful for frameworks that build on Gson.
2015-09-07 22:31:43 -04:00
Dorvaryn
618343fd1b Clarify the fact that the behaviour of getDelegateAdapter depends on registration order. 2015-09-03 18:15:24 +01:00
Inderjeet Singh
0c4ae01836 Updated Gson Javadoc to indicate thread-safety. 2015-08-10 19:34:07 +05:30
inder123
2ee680a645 Revert "Add a JSR-305 @ThreadSafe annotation to the Gson class" 2015-08-10 19:31:18 +05:30
Stefan Ferstl
82edd57205 Add a JSR-305 @ThreadSafe annotation to the Gson class
- Add an optional dependency to com.google.code.findbugs:jsr305.
  The optional scope is used in order to avoid introducing a new
  transitive dependency to the jsr305 library. This is fine because the 
  @ThreadSafe annotation has only a documentary purpose and it is not
  retained at runtime.
- Annotate the Gson class as @ThreadSafe

Fixes Issue #613
2015-07-13 18:34:38 +02:00
Inderjeet Singh
8d5a41329e added tests for Throwable. Revised ReflectiveTypeAdapterFactory to ignore self-referencing fields. 2014-11-16 22:55:18 +00:00
Inderjeet Singh
b6a625fb6c fixed issue 469 by adding a TypeAdapterFactory for throwables that ignores cause if it is self-referencing 2014-11-16 22:25:23 +00:00
Inderjeet Singh
f2591b6664 adjusted factory finding code to take into account non-present factories 2014-11-10 23:15:31 +00:00
Jake Wharton
7f8f490fdc Re-order factories to allow @JsonAdapter on enums which are user-defined types. 2014-11-04 00:59:42 +00:00
Jesse Wilson
125e6d9d3d Change field annotations to take precedence over registered type adapters. 2014-08-02 18:22:43 +00:00
Inderjeet Singh
b373c20136 Fixed issue 552 by documenting when fromJson returns null. 2014-03-29 23:28:52 +00:00
Inderjeet Singh
c53e255105 Fixed typo as mentioned in issue 565 2014-03-26 18:07:59 +00:00
Inderjeet Singh
edf66083e6 renamed @Adapt to @JsonAdapter 2014-03-26 17:59:54 +00:00
Inderjeet Singh
7f6a096030 renamed JsonAdapter annotation to Adapt annotation. 2014-03-09 23:08:54 +00:00
Inderjeet Singh
6e8d3cd65e Created threadsafe implementation of JsonAdapter invocation. Also fixed a bug where runtime generated typeadapters were being carried over from a toJson/fromJson call to the next. 2014-03-09 23:00:53 +00:00
Inderjeet Singh
e280ffd7e2 Fixed broken test to ensure that a field JsonAdapter annotation supersedes the class JsonAdapter annotation.
Added a map in Gson to keep track of TypeAdapters which are generated by Gson.
2014-03-09 08:36:24 +00:00
Inderjeet Singh
b9998e511f deleted support for the magic GSON_TYPE_ADAPTER field 2014-03-09 07:30:37 +00:00
Inderjeet Singh
67d512ee7d Created a JsonAdapter annotation that can be applied to classes to indicate their TypeAdapter. 2014-03-08 22:37:19 +00:00
Inderjeet Singh
7c97ac2944 Updated Gson version to 2.3-SNAPSHOT since this is a new feature.
Added support for a magic field GSON_TYPE_ADAPTER in a class. This adapter is automatically invoked if present.
The field must be present in the class (not in any super-type), and must be strongly typed as TypeAdapter<T>.
2014-03-08 20:08:13 +00:00
Jesse Wilson
63142f621c Use the right method name in error messages.
Fixes issue 498.
2013-02-04 16:05:00 +00:00
Joel Leitch
6dc6b4be92 Fix object leak from ThreadLocal. 2013-01-14 22:05:28 +00:00
Joel Leitch
b0531e1649 Ensure "excluder" is added prior to user defined type adapters/factories.
- Added test expose bad behaviour.
2012-12-20 19:41:33 +00:00
Jesse Wilson
af4879dbb7 Move interceptors from 'alpha' to 'extras'.
This makes the feature less risky to use! It now uses our
TypeAdapterFactory infrastructure rather than relying on
parallel infrastructure.
2012-10-23 17:36:30 +00:00
Jesse Wilson
1e18dce002 Don't subclass ThreadLocal.
This attempts to address issue 402, wherein subclassing ThreadLocal is pinning a reference to a class, which transitively pins the entire application in containers like Tomcat.
2012-10-23 02:41:34 +00:00
Jesse Wilson
22c835f2bc Fix compile warnings 2012-10-23 02:40:14 +00:00
Inderjeet Singh
fd4fbe4132 Added support for collections, maps, and arbitrary depth of type adapters for Intercept annotation.
Added more tests for the features.
2012-10-18 02:37:43 +00:00
Inderjeet Singh
c25278b4d6 Created an alpha package that holds experimental feature.
Added support for JsonPostDeserializer that allows you to invoke postDeserialize methods on an Gson deserialized object.
2012-10-11 03:20:36 +00:00
Inderjeet Singh
b946a229b6 deleted unused field. 2012-07-03 00:28:55 +00:00
Jesse Wilson
4816941f0d Address code review comments on r1154 2012-07-02 20:32:38 +00:00
Jesse Wilson
dc4e43bb23 Permit users to define type adapters for primitive types and strings.
Also expose an API to get the field naming strategy.
2012-06-30 02:37:49 +00:00
Inderjeet Singh
83e5a4937c Renamed Gson.getNextAdapter to getDelegateAdapter.
Deleted testParameterizedMapSubclassDeserialization which we decided to not fix.
Added simple tests for getDelegateAdapter
2012-04-12 18:49:27 +00:00
Jesse Wilson
9be0fd9ecc Make the BigDecimal and BigInteger type adapters user-overrideable. 2012-03-18 17:55:15 +00:00
Jesse Wilson
dd86d63436 Use inner classes for BigDecimal and BigInteger type adapters 2012-02-11 20:14:23 +00:00
Jesse Wilson
bb8dca71c4 Restore ability of instance creators to create collection and map types. We inadvertently lost this in Gson 2.0 and 2.1. Nobody noticed! 2012-01-01 15:46:33 +00:00
Jesse Wilson
796a381279 Kill GsonInternalAccess. Clients to this were all broken because nobody was ever assigning INSTANCE. 2012-01-01 12:42:20 +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