Commit Graph

81 Commits

Author SHA1 Message Date
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
Joel Leitch
ba0cd254a9 Clean up warnings. 2011-03-15 15:38:17 +00:00
Joel Leitch
114633fbf9 Provide a means to add serialization or deserialization specific exclusion strategies. 2011-02-04 03:09:41 +00:00
Joel Leitch
56aa828350 Minor clean-up in Gson class. 2011-01-22 22:43:43 +00:00
Joel Leitch
b883f8f4aa Add new "Mode" enum and carry mode through Gson so exclusion strategies know whether it is currently serializing or deserializing.
Deprecate old ExclusionStrategy code since this new approach is more powerful.
2011-01-22 22:15:06 +00:00
Inderjeet Singh
2b9f81e8b5 Registering default type hierarchy adapters first and allow users to override them.
This allows the default EnumTypeAdapter to be overridden for a specific hierachy adapter for Enum with anonymized sub-classes.
2011-01-19 23:28:28 +00:00
Jesse Wilson
1c5f5132d8 Revert most of r677: Required strings to be quoted even in lenient mode. As far as Inderjeet and I can tell, this is consistent with Gson 1.5. 2010-11-24 23:22:13 +00:00
Joel Leitch
0a3f5fa801 Required strings to be quoted even in lenient mode.
As far as Inderjeet and I can tell, this is consistent with Gson 1.5.
2010-11-16 22:14:40 +00:00
Joel Leitch
7d055fcb51 Fixing fromJson type casting. 2010-11-11 18:22:45 +00:00
Joel Leitch
32afd1a4e4 Fixing parsing of unquoted strings to be (somewhat) consistent with previous versions of Gson. The difference with this version is that Gson will throw a more specific exception rather than JsonParseException. 2010-11-10 02:02:57 +00:00
Inderjeet Singh
10db917e93 Updated fromJson and toJson signatures to indicate the kind of exceptions (JsonIOException, JsonSyntaxException) that can be thrown. 2010-11-03 19:46:29 +00:00
Inderjeet Singh
83539c534c removed compiler warnings.
Added default serial version id for MalformedJsonException.
2010-11-03 13:28:09 +00:00
Jesse Wilson
dea7ab89fe Restore pretty printing. The pretty printing format isn't as compact as the previous format - for example arrays of integers are printed one-per-line, whereas the previous format compacted these to all sit on the same line. 2010-11-01 23:03:41 +00:00
Jesse Wilson
c8c3a6965c Fix a regression that expects different type adapters for long.class and Long.class. This is a temporary fix; later we may want to always use the canonical wrapped class. 2010-11-01 22:46:20 +00:00
Jesse Wilson
20d895ff95 Fix primitive wrapping and casting.
Issue: 235
2010-11-01 22:36:30 +00:00
Inderjeet Singh
d3eda04f33 Added support for deserializing from null input to a null value.
Added toString() method to ObjectTypePair.
2010-10-22 16:06:59 +00:00
Inderjeet Singh
91bee2a688 Throwing JsonIOException on write failures 2010-10-18 23:58:09 +00:00
Inderjeet Singh
2b1f3eec15 Removed a bunch of unused code and unnecessary else statements. 2010-09-28 13:42:43 +00:00
Jesse Wilson
747e3c3051 Support mixed streaming and databinding with new APIs. 2010-09-02 00:15:23 +00:00
Jesse Wilson
fa40b4c63a Rename GsonReader to Streams; check that class in. 2010-09-02 00:10:02 +00:00
Jesse Wilson
7a7bbf754c Use JsonReader internally rather than JsonParserJavacc.
For raw parsing (ie. new JsonParser().parse()) the parse time has improved substantially. For example, JsonParserJavacc parsed my 48KiB buzz feed in 4.8ms. JsonReader parses the same feed in 0.9ms.

http://microbenchmarks.appspot.com/run/limpbizkit@gmail.com/com.google.gson.GsonBenchmark/430001
2010-08-27 05:59:18 +00:00
Joel Leitch
e3af076ff2 Deprecate the FieldNamingStrategy interface and replace it with FieldNamingStrategy2. This is the first step to help make it easy to cache field annotations across all instances of a class, etc. 2010-01-09 22:43:27 +00:00