Commit Graph

102 Commits

Author SHA1 Message Date
Jesse Wilson
de835d4dcd Roll back JsonSerializationContext and JsonDeserializationContext to their 1.7.2 API. 2011-10-01 00:58:25 +00:00
Inderjeet Singh
d3f927eb42 Pure refactorings:
Replaced DEFAULT_SERIALIZERS, DEFAULT_DESERIALIZERS and DEFAULT_INSTANCE_CREATORS with a single EMPTY_MAP.
Removed obsoleted TODO from Gson.
made ParameterizedTypeHandlerMap.makeUnmodifiable a builder method that returns this instance.
2011-09-30 17:56:40 +00:00
Inderjeet Singh
1470f20fc0 Removed unused field 2011-09-30 17:11:44 +00:00
Inderjeet Singh
47a36fd095 Fixed Eclipse warnings 2011-09-30 17:08:35 +00:00
Jesse Wilson
cf15565243 Don't round trip through strings 2011-09-30 07:24:07 +00:00
Jesse Wilson
bb7f0b6bb0 Adopt JsonElementWriter in GSON.
Add setSerializeNulls() to JsonWriter, so nulls can be skipped from serialization. This does not yet impact JsonElementWriter.

One change in behavior: if the only value is skipped, we now emit "null" rather than "".
2011-09-30 07:08:44 +00:00
Jesse Wilson
46e65a77c5 Convert RuntimeTypeAdapter to a TypeAdapterFactory; this avoids the need for serializeDefault() 2011-09-28 19:14:46 +00:00
Jesse Wilson
3f26144165 Fix date adapters to work when run in any time zone. 2011-09-28 17:56:54 +00:00
Jesse Wilson
3b3a60d301 Use new instances of DateTypeAdapter and TimeTypeAdapter for each GSON; this guarantees that the TimeZone and Locale are what they should be 2011-09-26 21:44:08 +00:00
Inderjeet Singh
c1bac6debf Converted Date type adapter to the new style. This was the last remaining old style default type adapter. 2011-09-25 21:51:28 +00:00
Inderjeet Singh
81854db4ac Converted java.sql.Timestamp type adapter to the new style. 2011-09-25 21:35:36 +00:00
Inderjeet Singh
f9b6c2095f Converted java.sql.Time type adapter to the new style. 2011-09-23 18:42:45 +00:00
Inderjeet Singh
467011c7ab Allowed users to override default type adapters for various classes. 2011-09-20 00:27:33 +00:00
Inderjeet Singh
8217aca925 Converted java.sql.Date type adapters to the new style. 2011-09-20 00:26:37 +00:00
Inderjeet Singh
d20df34b8b Converted Calendar/GregorianCalendar type adapters to the new style. 2011-09-20 00:08:33 +00:00
Inderjeet Singh
4402240294 Converted Number type adapter to the new style. 2011-09-19 17:02:02 +00:00
Inderjeet Singh
2780a2a9bf Fixed eclipse warnings. 2011-09-16 06:03:16 +00:00
Inderjeet Singh
b5f8ef6e16 Converted CharacterTypeAdapter to the new style. 2011-09-16 05:58:41 +00:00
Inderjeet Singh
c71e61cf48 Converted EnumTypeAdapter to new style.
Got rid of default Hierarchy Serializer/Deserializers from DefaultTypeAdapters.
Got rid of methods for gettting default serializers/deserializers/instance creators. Instead we reuse the static final instances.
Fixed warnings in TypeAdapters where a parameterized type T was hiding the parameterized T in methods.
Removed support to unwrap single element array of enums into enum values. Also removed the test that verifies this behavior.
2011-09-16 05:40:05 +00:00
Inderjeet Singh
915c5d4d6f Converted BitSetTypeAdapter to the new style. 2011-09-16 05:02:30 +00:00
Jesse Wilson
a98d6eae47 Fix the map type adapter to support array serialization natively. 2011-09-12 05:51:17 +00:00
Jesse Wilson
25c6ae177b Down to 22 failing tests.
Consolidated all of the different code paths that we use to construct instances. We now have an ObjectConstructor class that knows what type it constructs; this means that we don't need to ever do reflection to lookup a constructor at construction time.

Cleaned up some buggy type adapters, particularly around handling of null.

Removed dead code for object graph navigation.

Moved some classes into 'internal' so they are visible to the 'bind' subpackage.

Turned some TypeAdapterFactory/TypeAdapter pairs inside out so that the TypeAdapter is now the inner class. This is necessary so that the factories can take parameters.

Added an API to request the 'next' type adapter for a type. This allows type adapters to compose other type adapters. We're using this in two places:
 - where the user has excluded a type from serialization but not deserialization, we need to use the "default" deserialization but interpose null on serialization. We create a type adapter that delegates for one and returns null for the other.
 - similarly when a DOM type serializer is registered but no deserializer, or vice versa.
This is the biggest change to the MiniGson core.

For backwards compatibility, return null for the empty string.

Simplify JsonSerializationContext/JsonDeserializationContext to simply call through to GSON. SerializeDefault is currently unsupported.

More useful error messages when calling getAsBoolean on a JsonNull.

Remove currently unused MemoryRefStack. We might need this back again, though wiring it back in will be much more difficult because we don't interject ourselves between the users' various type adapters.
2011-09-11 07:04:56 +00:00
Jesse Wilson
d22e11b184 Let the user override the byte[] type adapter 2011-09-09 08:04:28 +00:00
Jesse Wilson
99801915aa More code through the same fromJson path 2011-09-09 05:40:34 +00:00
Jesse Wilson
9db0c53217 Adapt bytes 2011-09-09 04:39:29 +00:00
Inderjeet Singh
ea9c0236c7 Converted InetAddress type adapter to new style. 2011-09-09 04:02:12 +00:00
Jesse Wilson
6029afb72d Use MiniGson's list adapters 2011-09-09 03:35:11 +00:00
Jesse Wilson
3aeb70e030 Adapter for Object.class 2011-09-09 03:31:16 +00:00
Inderjeet Singh
9fb39c89ea Switched Locale type adapter to new-style. 2011-08-26 03:14:01 +00:00
Inderjeet Singh
f9976f4b01 Switched Short, URI, URL, UUID, StringBuilder and StringBuffer type adapters to new-style. 2011-08-26 02:33:54 +00:00
Inderjeet Singh
bafc43afae removed unneeded exception catch clause. 2011-08-19 03:16:51 +00:00
Inderjeet Singh
84c71409da Removed Gson type adapters for boolean, integer, float, double, String, BigDecimal and BigInteger.
Switched Gson.fromJson() methods to use miniGson directly instead of using a DOM.
2011-08-19 03:13:06 +00:00
Jesse Wilson
ff88ac32f2 Use MiniGSON for deserialization. 2011-08-12 18:24:20 +00:00
Joel Leitch
70965eae03 Adding new type adapters for BigInteger and BigDecimal types. 2011-08-12 02:20:48 +00:00
Inderjeet Singh
ad5ff0f2d9 Created a wrapper for runtime type determination. 2011-08-05 00:41:24 +00:00
Jesse Wilson
fc99556f22 Support type exclusion strategies. 2011-08-05 00:25:49 +00:00
Jesse Wilson
1885ba7dec Restore support for serializeSpecialFloatingPointValues. 2011-08-04 23:12:49 +00:00
Jesse Wilson
aa067056c3 Restore support for long serialization policy. 2011-08-04 22:57:36 +00:00
Inderjeet Singh
f1f8b666ec Implemented support for FieldNamingPolicy with MiniGson. 2011-08-03 02:51:59 +00:00
Inderjeet Singh
d70fb90ef7 Added methods to convert to JsonElement in TypeAdapter.
Using lenient mode while working with Gson.
Handling nulls while invoking legacy Gson type adapters.
2011-08-03 02:40:18 +00:00
Inderjeet Singh
566c27cf21 Adapted legacy Gson adapters into mini Gson. 2011-08-03 02:17:42 +00:00
Inderjeet Singh
f276d13827 Added support for deserialization exclusion strategy. 2011-08-03 01:19:26 +00:00
Inderjeet Singh
3331dcdab0 Using serializationExclusionStrategy while navigating through fields to decide which ones to skip. 2011-08-03 00:47:36 +00:00
Jesse Wilson
37abcf3637 Break 203 tests and adopt the new stream binding internally. Test fixes coming soon... 2011-08-03 00:28:02 +00:00
Inderjeet Singh
e79bcde8bf Using JsonNull.INSTANCE instead of JsonNull.createJsonNull() method 2011-05-25 16:55:57 +00:00
Joel Leitch
572421b771 Open object construction in JsonDeserializationContext to leverage the same object construction as default gson deserialization. 2011-05-20 21:50:39 +00:00
Inderjeet Singh
5bc80cd693 Moved Cache, LruCache, Pair, Primitives and UnsafeAllocator to com.google.gson and made them package private. 2011-03-30 13:59:06 +00:00
Jesse Wilson
4efb133b4a bling bling
Prefix internal classes with $ to prevent them from interfering with IDE's auto import functionality.
2011-03-29 21:24:26 +00:00
Inderjeet Singh
337d89cf3f Removed ObjectNavigatorFactory 2011-03-24 20:19:41 +00:00
Joel Leitch
861e047a62 Create an "internals" package for classes that we do not want to share, but is needed across multiple pacakges.
As well, move non-Gson specific classes, such as Preconditions, to this new "internals" package.
2011-03-21 22:30:35 +00:00