Inderjeet Singh
a09c3ab1c5
Added tests to validate issue 272. The tests currently pass so it is not a valid bug.
2011-01-24 22:40:42 +00:00
Joel Leitch
56aa828350
Minor clean-up in Gson class.
2011-01-22 22:43:43 +00:00
Joel Leitch
fb7bd7b1b7
Deprecate the old FieldNamingStrategy interface and open up the FieldNamingStrategy2 instead to take its place.
2011-01-22 22:27:30 +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
fd0f526fb0
Basic functional test for type hierarchy adapter.
2011-01-19 23:25:27 +00:00
Jesse Wilson
a526da7cdd
Tests that demonstrate that type variables work.
...
Fixes issue 168.
2011-01-19 22:24:10 +00:00
Inderjeet Singh
edc71130c4
removed unneeded suppression of warnings.
2011-01-19 07:34:44 +00:00
Inderjeet Singh
b3685cff1e
added version numbers to various plugins.
...
replaced now deprecated ${version} with ${project.version}
2011-01-18 23:03:58 +00:00
Inderjeet Singh
9a792a9952
added tagbase to maven release plugin in POM
2011-01-18 22:52:45 +00:00
Inderjeet Singh
ce3520f5b5
disabling an assert that was causing failed test.
...
Per Jesse, this assertion is too difficult to support reliably.
2011-01-13 07:35:11 +00:00
Jesse Wilson
37dc0f8d3e
Type adapter for maps. Supports both complex and non-complex keys.
2011-01-12 00:17:21 +00:00
Joel Leitch
bd3e680f94
Fixing rollback.
2011-01-11 22:24:14 +00:00
Joel Leitch
fa7f8cc2eb
Rolling back test deletion.
2011-01-11 22:21:41 +00:00
Joel Leitch
439d931c5a
Removing unused methods on Cache and synchronizing it since FieldAttributes contains a static instance of this type.
2011-01-10 23:20:37 +00:00
Joel Leitch
1e2fbd81f5
Adding default type adapter for InetAddress.
2011-01-10 23:03:48 +00:00
Joel Leitch
3926afbd30
Removing unused files with the new Types class.
2011-01-10 22:47:42 +00:00
Inderjeet Singh
0e5f6704cd
Added sonatype oss as parent for the pom. Diabled repository management with-in POM per instructions at: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
2011-01-10 22:47:36 +00:00
Inderjeet Singh
25f0014305
Added SNAPSHOT tag.
...
Added Google as organization and Jesse Wilson as developer.
2011-01-10 22:36:24 +00:00
Inderjeet Singh
8380d28e6f
removed compiler warnings
2010-12-06 19:47:41 +00:00
Jesse Wilson
883ce465d5
Second half of adopting Guice's types code.
...
This removes a bunch of unnecessary public APIs and looks more like the GSON code that existed before this whole exercise. We no longer use TypeToken.isAssignable. I wrote a test that demonstrates at least one problem with that method, so I've deprecated it. We should be able to remove it release-after-next; nobody should be using this method anyway.
There are still some things that are public that shouldn't be. In particular there's some APIs in Types that are needed by TypeToken, which is unfortunately in a different package. Traditionally the fix is to create an 'internal' package and make the shared code public in the internal package. I'm not sure what we want to do for GSON; we could also use reflection (yuck) or duplicate the code (yuck).
2010-12-03 18:12:26 +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
faa5464e84
updated current version to 1.7. Added stream package to OSGI. Added maven-changes-plugin.
2010-11-25 20:00:38 +00:00
Inderjeet Singh
5be830835d
Added report for subversion changelogs
2010-11-25 15:15:41 +00:00
Inderjeet Singh
9f5aa1772b
added reports on TODO tags
2010-11-25 15:07:44 +00:00
Inderjeet Singh
6818edecf9
enabled GsonBuilder.registerTypeHierarchyAdapter since head is now for Gson 1.7
2010-11-25 00:16:06 +00:00
Inderjeet Singh
e061d0e563
Added findbugs reporting in maven pom.xml
2010-11-25 00:14:49 +00:00
Jesse Wilson
90e7de92df
New Javadocs for 1.6
2010-11-24 23:41:30 +00:00
Jesse Wilson
1672d2cfe0
Removing GSON 1.5 javadocs
2010-11-24 23:40:29 +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
Inderjeet Singh
d87eed510b
Fixed compilation problem since we dropped registerTypeHierarchyAdapter method
2010-11-24 23:14:30 +00:00
Inderjeet Singh
db3f19e881
dropping GsonBuilder.registerTypeHierarchyAdapter() from 1.6 release.
2010-11-24 23:13:29 +00:00
Inderjeet Singh
98ff894863
removed unnecessary else clause.
2010-11-22 23:14:51 +00:00
Joel Leitch
56344cf067
Remove duplicate test.
2010-11-16 22:18:28 +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
Inderjeet Singh
279649986e
Added a test to ensure that Gson handles repeated invocation of itself correctly.
...
Revised proto maven configuration to use Gson 1.6
2010-11-15 22:56:01 +00:00
Inderjeet Singh
520259fefa
removed eclipse warnings.
2010-11-12 19:21:16 +00:00
Joel Leitch
7d055fcb51
Fixing fromJson type casting.
2010-11-11 18:22:45 +00:00
Inderjeet Singh
eac1505670
Removed eclipse warnings about unneeded else statements and rawtypes/unchecked access.
2010-11-11 07:29:55 +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
Jesse Wilson
103edb9c36
Don't return null on an unexpected EOF unless the document is empty. This brings us back to compatibility with GSON 1.5.
2010-11-08 19:16:05 +00:00
Jesse Wilson
4d0cd67cde
Addressing code review feedback from r585 and r648.
2010-11-08 01:22:21 +00:00
Joel Leitch
6a951b427e
Adding new tests (two of which are disabled, but prepping for 1.7).
2010-11-05 22:57:44 +00:00
Joel Leitch
f6a332971f
Warning fixes.
2010-11-05 22:47:13 +00:00
Inderjeet Singh
f4098b5cf7
implemented feedback from r585
2010-11-05 22:18:35 +00:00
Inderjeet Singh
c3bae2d35e
incorporating code review comments from r648
2010-11-05 21:51:29 +00:00
Jesse Wilson
832257234d
New overloads for constructing MalformedJsonException
2010-11-05 20:58:41 +00:00
Joel Leitch
bdf5bef887
Fix JavaDoc on JsonSyntaxException
2010-11-05 20:34:27 +00:00
Inderjeet Singh
0b4bf7706a
Changed JsonParser API to throw specific JsonIOException,JsonSyntaxException instead of the general JsonParseException
2010-11-05 20:31:52 +00:00
Inderjeet Singh
7b99419aea
Removed compiler warnings.
2010-11-03 23:14:42 +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
Inderjeet Singh
82a1a9511e
removed a System.out.println from a test.
2010-11-03 01:25:57 +00:00
Inderjeet Singh
200bccef21
Added tests for issue 249
2010-11-03 00:15:03 +00:00
Joel Leitch
c6a4f55d1a
Fix for Issue #40 .
2010-11-02 03:32:39 +00:00
Inderjeet Singh
a224bb1e2b
added serial version id
2010-11-01 23:16:03 +00:00
Inderjeet Singh
ad7bd1f465
removed unused JsonFormatter classes.
2010-11-01 23:10: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
Inderjeet Singh
43f2a0012b
Removed JavaCC parser definition and its generated classes.
2010-11-01 22:57:39 +00:00
Inderjeet Singh
abe244c099
renamed com.google.gson.stream.JsonSyntaxException to MalformedJsonException.
...
Throwing JsonSyntaxException instead of JsonParseException where we can detect a syntax error.
2010-11-01 22:48:52 +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
Joel Leitch
d0977c2e3a
Exposing the declaring class for the field wrapped by FieldAttributes.
2010-11-01 22:31:48 +00:00
Inderjeet Singh
7127be7965
Updated the OSGi descriptor to 1.6
2010-11-01 22:12:58 +00:00
Inderjeet Singh
7ea5cc2b36
Added a new JsonSyntaxException to indicate syntax errors in Gson.
2010-11-01 17:53:31 +00:00
Jesse Wilson
d9feb90593
Small cleanup of exception conversion.
2010-10-31 04:58:23 +00:00
Jesse Wilson
b2005299e4
Make JsonSyntaxException public, so clients can differentiate between IO problems and malformed JSON.
2010-10-30 21:32:08 +00:00
Inderjeet Singh
2b993d83b6
Made the GsonBuilder registerTypeHierarchyAdapter a public method.
...
Updated the Gson version number to 1.6 and added @since tag for the new classes
2010-10-27 23:53:09 +00:00
Inderjeet Singh
9b10e70a79
Removed the version numbers from the plugin configuration of pom.xmls. This ensures that the latest version of the plugins gets downloaded and used while building a project.
2010-10-25 23:09:24 +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
18a9205a04
Added an exception class to indicate IO Errors.
2010-10-18 23:54: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
4c53c0640e
Exhaustive test coverage for mixed streaming & binding.
2010-09-03 07:24:59 +00:00
Jesse Wilson
4e28bf3a39
Check in a passing test for issue 204.
2010-09-03 06:44:41 +00:00
Jesse Wilson
202bbfeef0
Fixing the Java 1.5 build.
2010-09-02 09:29:26 +00:00
Jesse Wilson
747e3c3051
Support mixed streaming and databinding with new APIs.
2010-09-02 00:15:23 +00:00
Jesse Wilson
ffdf0e7012
Fix some test problems.
...
JsonWriter was using suboptimal escape characters for newlines etc: unicode escapes rather than \x escapes.
JsonObjectTest was banning empty and whitespace-only keys. These values are permitted as of r585.
2010-09-02 00:10:26 +00:00
Jesse Wilson
fa40b4c63a
Rename GsonReader to Streams; check that class in.
2010-09-02 00:10:02 +00:00
Jesse Wilson
78d1011ec5
Test escaping HTML characters!
2010-09-02 00:03:18 +00:00
Jesse Wilson
486820f515
Fix some test problems.
...
JsonWriter was using suboptimal escape characters for newlines etc: unicode escapes rather than \x escapes.
JsonObjectTest was banning empty and whitespace-only keys. These values are permitted as of r585.
2010-08-28 08:18:13 +00:00
Jesse Wilson
ff7aa3f331
Escape only the required characters when emitting JSON. This means that instead of emitting
...
["foo\nbar", "baz"]
we'll emit this:
["foo
bar", baz"]
This simple change measured about ~35% faster for in-memory writes!
2010-08-28 07:29:22 +00:00
Jesse Wilson
7e1e4eab07
Remove the constraint that map keys mustn't be the empty string.
...
See bug 227.
2010-08-28 05:02:33 +00:00
Jesse Wilson
69ecb9465a
Test case demonstrating that issue 212 is fixed. We got comment parsing support for free when we switched to JsonReader.
2010-08-27 07:33:33 +00:00
Jesse Wilson
d5741b321f
Don't exclude enum constants, even if they are anonymous.
...
See issue 226.
2010-08-27 07:26:35 +00:00
Jesse Wilson
eb7b1e4ac7
Test attempting (and failing) to reproduce issue 215.
2010-08-27 07:10:00 +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
Jesse Wilson
765a9f1ecd
Brand new classes for streaming JSON efficiently.
...
Notable features:
- Efficiency. The parser is faster than the current javacc parser. It's also faster than popular libraries for JSON streaming.
- Toggle lenient/strict
- Toggle pretty/compact
- Friendly error messages on bad JSON
- GSON-quality Javadoc
- Non-execute prefix handling
This doesn't wire JsonReader up into Gson just yet. That's coming soon...
2010-08-26 08:44:02 +00:00
Joel Leitch
5bffa1f679
Fix for Issue 178.
2010-08-21 06:50:52 +00:00
Joel Leitch
3fc4bcc061
Minor test fixes. Explicitly fail test if the expected exception was not thrown.
2010-08-21 03:19:17 +00:00
Inderjeet Singh
de0f8da151
replaced unchecked suppressed warnings token with more specific rawtypes.
...
removed unused imports.
2010-08-20 16:27:46 +00:00
Inderjeet Singh
ed838ec104
replaced unchecked suppressed warnings token with more specific rawtypes
2010-08-20 16:20:37 +00:00
Jesse Wilson
bc5b836103
Test demonstrating a bug reported in issue 182, wherein malformed JSON is emitted when an property name contains a double-quote.
2010-08-20 05:45:51 +00:00
Jesse Wilson
8b5cc3256d
Test demonstrating a bug reported in issue 178, wherein malformed JSON is emitted when a map key contains a double-quote.
2010-08-20 05:43:17 +00:00
Inderjeet Singh
cb6de44b56
Javadocs for Gson 1.5
2010-08-20 01:12:27 +00:00
Inderjeet Singh
24fd66f645
removed @since for non-public classes
2010-08-20 00:35:48 +00:00
Inderjeet Singh
dc60cb1931
Made FieldNamingStrategy2 is package protected class.
...
Made type hierarchy adapter registration package protected.
Marked some of the classes final.
Minor changes in the performance tests.
2010-08-19 00:10:42 +00:00
Joel Leitch
89c18452ae
Ensure date with pattern is not override with the "default" date type adapter when a custom JsonSerializer/JsonDeserializer is registered.
2010-08-18 23:58:52 +00:00
Inderjeet Singh
c3f61ee5ad
Added a test to reproduce bug described in http://groups.google.com/group/google-gson/browse_thread/thread/9591c539e3c19d59
...
Seems like an invalid bug report as Gson can deserialize primitive values in Integer fields.
2010-07-19 23:32:24 +00:00
Inderjeet Singh
b2af57d288
Added checks to ensure that typeHierarchyAdapter being registered doesn't hide a previously existing one.
...
Fixed a bug where registerIfAbsent was adding type adapters in the reverse order of priority.
Added toString() to Pair.
2010-06-24 21:51:18 +00:00
Inderjeet Singh
8aedbc84db
Added a new GsonBuilder option to register a type adapter for a type hierarchy instead of a single type.
...
Upgraded Gson version to 1.5 since a new API call is being added.
2010-06-21 23:26:06 +00:00
Inderjeet Singh
6728c742d2
Updated log statements to be localizable.
2010-06-15 20:40:12 +00:00
Joel Leitch
9cd72ca7fb
Add new tests with SerializedName annotation that contains a space in the name.
2010-05-28 02:13:11 +00:00
Joel Leitch
855a79a0f0
Stop generating the Parser class on mvn:compile or mvn:package.
2010-05-28 02:11:38 +00:00
Joel Leitch
ba0154867d
Add support to allow spaces in the JSON field name.
2010-05-26 17:40:19 +00:00
Joel Leitch
389f918bb8
Add new performance test for large objects (many fields).
2010-05-19 21:29:58 +00:00
Joel Leitch
9c7bfc677a
Allow cache size to be configured.
2010-05-19 20:47:27 +00:00
Joel Leitch
2610a2920d
Update Parser to add members to an JsonObject within a loop rather than a recursive call.
2010-05-19 20:44:27 +00:00
Joel Leitch
bf2a0e4e0b
Adding tests to ensure the adapter from the old to new naming strategy is working properly.
2010-01-10 03:27:59 +00:00
Joel Leitch
9816426bba
Add new Cache interface and LRU Cache implementation to cache field annotations per "Class" (rather than per instance). This results in a significant speed-up (approx. 3X) when serializing/deserializing the same classes over and over again.
2010-01-10 00:32:21 +00:00
Joel Leitch
e6496fddd6
Update JavaDoc to link to the correct interface (FieldNamingStrategy2).
2010-01-09 22:48:53 +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
Inderjeet Singh
7079799890
Fixed issue 167 by adding support for TreeSet deserialization. Added tests for serialization/deserialization of treesets.
2010-01-08 19:14:42 +00:00
Inderjeet Singh
058f7344db
Revised the setup for date/time tests to use PST time-zone. This fixes bug 184 by ensuring that tests are run in PST time-zone.
2010-01-08 18:53:39 +00:00
Inderjeet Singh
15fa10943c
Fixed serializers and deserializers for java.sql Date and Time to ensure that Date does't serialize time, and time does't serialize the date portion.
2009-12-04 18:15:00 +00:00
Inderjeet Singh
ebf24fbda5
Fixed issue 134 by adding support for java.sql Date and Timestamp classses.
2009-12-04 01:21:13 +00:00
Joel Leitch
c329d020b9
Make some fields final and initialize immediately.
2009-12-03 23:13:39 +00:00
Joel Leitch
33e816dcf0
More lazy initialization done for FieldAttributes.
2009-12-03 22:28:58 +00:00
Joel Leitch
641390b1a1
Lazily initialize fields in FieldAttributes to prevent multiple Java reflection invocations.
2009-12-03 22:17:39 +00:00
Inderjeet Singh
610580b8d9
exposed final fields of Pair for fast access. Pair is used quite a bit during serialization because of its use in ref stack.
2009-12-03 20:58:22 +00:00
Inderjeet Singh
fff9147988
Added some tests to measure serialization and deserialization performance of Gson based on the discussion in http://groups.google.com/group/google-gson/browse_thread/thread/7a50b17a390dfaeb
...
Surprising just marking a field as exposed halves the performance.
2009-10-20 00:04:34 +00:00
Joel Leitch
015d2016c5
Last JavaDoc Update missed adding the new files.
2009-10-09 23:55:54 +00:00
Joel Leitch
be2631e835
Updating JavaDocs
2009-10-09 23:49:13 +00:00
Joel Leitch
102f8b3a71
Adding a few more assert to the InstanceCreatorTest to ensure that the default values are set for sub class fields.
2009-10-09 21:23:51 +00:00
Joel Leitch
d87d3f807f
Added functional tests for user defined exclusion strategy.
...
Added test to ensure empty/null properties are added for the JsonObject.
2009-10-09 21:12:07 +00:00
Inderjeet Singh
bc1e5c5c99
Ensured that custom deserializer is invoked with actual type returned for field values.
...
Fixed a bug where a top-level object was constructed with default values even when the custom deserializer tried to set it to null.
2009-10-09 19:41:33 +00:00
Inderjeet Singh
338758a0d3
implemented support for deserialization to deserialize to more specific type if an instance creator returns a sub-class.
2009-10-09 18:16:16 +00:00
Joel Leitch
fffb204cee
Removed import for java.util.Map.Entry.
2009-10-09 18:10:43 +00:00
Joel Leitch
de6af4411b
Minor fixes.
2009-10-09 15:43:50 +00:00
Inderjeet Singh
60ef777efc
Fixed custom serilization invocation to correctly handle nulls returned by custom serializer.
2009-10-09 15:28:05 +00:00
Joel Leitch
6387c9028e
Updated JavaDoc formatting
2009-10-09 15:26:34 +00:00
Joel Leitch
81e6ae25f1
Make FieldAttributes public so it can be used by public clients.
2009-10-09 03:11:16 +00:00
Joel Leitch
282ef30280
Updating JavaDoc tag to @code instead of @link.
2009-10-09 03:03:04 +00:00
Inderjeet Singh
e37add7836
Implemented some code review comments from r482
2009-10-09 01:35:45 +00:00
Joel Leitch
6d60a7db1d
Fixed comments from r486.
2009-10-09 00:36:22 +00:00
Inderjeet Singh
2bddd575b3
Code review changes from r476
2009-10-08 23:23:52 +00:00
Joel Leitch
93b0008486
Adding restrictions on the JsonElements to disallow Java "null"s.
2009-10-08 22:03:08 +00:00
Joel Leitch
10c39317a1
Makes ExclusionStrategy public.
2009-10-08 21:52:56 +00:00
Joel Leitch
dc5922e703
Addresses comments in r481 (except for the interface change....leaving FieldAttributes as a class).
...
Change the exclusion order in ObjectNavigator to exclude a top-level class (if exclusion strategy suggests class should be skipped) even if it is marked with a custom (de)serializer.
2009-10-08 20:51:40 +00:00
Inderjeet Singh
e9c156b016
Added inheritance tests using toJson() method as well.
2009-10-08 19:32:15 +00:00
Inderjeet Singh
b634804533
Ensured that a base class custom serializer is run when the type is specified explicitly during serialization. For all other situations, ensured that the actual type of the object is taken into consideration while serializing. First a custom handler corresponding to the actual type is looked up, then a custom handler for the specified type.
...
Created some serialization specific tests regarding custom serializers. Revised some tests to use toJsonTree for better asserts instead of string matching.
2009-10-08 19:28:53 +00:00
Joel Leitch
839b0c2f94
Refactored exclusion strategies so that they can easily be exposed as part of the public API.
2009-10-07 09:23:14 +00:00
Joel Leitch
c892738fbb
Re-enabling the ' (apostrophe) escaping with valid JSON escaping.
2009-10-07 03:48:29 +00:00
Inderjeet Singh
536a968b32
Disabled escaping of single quote since it is valid for JSON (though invalid for JavaScript).
...
Added null checks in contexts since the custom type adapter can pass nulls.
2009-10-06 17:10:52 +00:00
Inderjeet Singh
d416361ac5
Added a test to ensure Gson can use JSON fields to store type information.
2009-10-06 04:25:28 +00:00
Inderjeet Singh
ae85e6cce6
A test to ensure that null values override default values when nulls are present in input Json during deserialization.
2009-10-06 01:55:44 +00:00
Inderjeet Singh
1da3ef9891
Ensured that a custom handler is not visited during deserialization.
...
Ensured that JsonTreeNavigator can handle null values as children of JsonObject. This is now possible since Gson exposes toJson(JsonElement) method to which the user can pass a JsonElement with null values.
2009-10-06 01:15:28 +00:00
Inderjeet Singh
ff74224815
Revised equals and hashcode of ObjectTypePair to ensure reference equality of object instead of value equality. Improved JavaDocs for various 1.4 API methods.
2009-10-05 18:17:52 +00:00
Inderjeet Singh
2716d96516
Revised ancestor stack to use both object and type
2009-10-03 04:45:12 +00:00
Joel Leitch
fbf834c3f6
Implemented suggests from r469 code review.
2009-10-02 20:33:37 +00:00
Joel Leitch
b28864eaa0
Remove unused import.
2009-10-02 20:22:43 +00:00
Joel Leitch
25ea878f66
Add some synchronization to the JsonStreamParser to ensure that the "next" method behaves according to the API.
2009-10-02 20:21:19 +00:00
Joel Leitch
912db55ba6
Added test for hasNext on JsonStreamParser.
2009-10-02 19:39:09 +00:00
Joel Leitch
0c2106f2ff
Adding test for new field naming policies from r456 code review.
2009-10-02 19:12:15 +00:00
Inderjeet Singh
40ca8b0537
Added copyright header per code review suggestion from r424
2009-10-02 18:46:56 +00:00
Inderjeet Singh
1dcdd3fb3f
Implemented suggestions from code review r432 by adding a JsonNull for primitives if the value is null.
2009-10-01 22:15:53 +00:00
Inderjeet Singh
c64b79c0f9
Implemented suggestions from the code review of r436: throwing NoSuchElementException in case the stream hits EOF.
2009-10-01 18:34:11 +00:00
Inderjeet Singh
3b1056c097
Renamed JsonParserAsync to JsonStreamParser as that is a more appropriate name.
...
Added a TODO in JsonSerializationVisitor per code review of r453.
2009-10-01 17:46:28 +00:00
Inderjeet Singh
8567fe6c10
Implementing code review comment from r428: Using Polymorphism for exclusion strategies for expose annotations.
2009-10-01 01:37:57 +00:00
Inderjeet Singh
77c2c29316
Implementing code review feedback from r454: using isFirst instead of the Stack to keep track of whether to add commas or not.
2009-10-01 00:57:55 +00:00
Inderjeet Singh
fbefa59b66
changed synchronization on Date type adapter to be for the format object per code review comments on r452
2009-09-30 23:11:30 +00:00
Inderjeet Singh
907082102d
Added code to ensure that circular reference situations with custom handlers are detected.
...
Split CircularReferenceTest out of ObjectTest.
2009-09-29 20:43:31 +00:00
Joel Leitch
933a3e5150
Allow serialization of nulls in a "List<Object>" type.
2009-09-29 20:34:35 +00:00
Joel Leitch
e5ed1cc59a
Added some more tests.
2009-09-29 20:24:48 +00:00
Joel Leitch
e73ad007a4
Added test that serialize interfaces.
2009-09-29 19:03:49 +00:00
Joel Leitch
563cd1e8e3
Adding the "since" tag.
2009-09-29 18:52:32 +00:00
Joel Leitch
ad4ff6996b
Adding new default field naming policy
2009-09-29 18:44:56 +00:00
Joel Leitch
553a619ebd
Allow dashes as part of the field name.
2009-09-29 18:40:08 +00:00
Inderjeet Singh
e9a2a1d0f7
Fixed Issue 153 by using a stack to keep track of first elements at any level.
2009-09-29 17:52:49 +00:00
Inderjeet Singh
3e7ebf8556
Fixed issue 156.
...
Added support for serializing an object field (or array elements) as per its actual type.
Refactored inheritance related tests into its own test class. Added regression tests for issue 156.
2009-09-25 19:54:25 +00:00
Inderjeet Singh
19ae6c0763
Fixed issue 162 by making default date adapter thread-safe by synchronizing serialize() and deserialize() methods.
2009-09-25 17:14:48 +00:00
Joel Leitch
8297437610
Reverting r499.
2009-09-23 19:25:50 +00:00
Joel Leitch
0e17041c8b
Added another test to JsonParserTest.
2009-09-23 19:21:09 +00:00
Joel Leitch
c6f762f36b
Fix Warnings
2009-09-23 19:09:01 +00:00
Joel Leitch
b0f50bb4be
Return a "JsonNull" object for empty whitespace input into the JsonParser.
2009-09-23 19:00:05 +00:00
Inderjeet Singh
fdcd3945c5
Fixed issue 147.
...
Integral values (byte, short, integer, long, BigInteger) are now comparable to each other.
Floating point values (float, double, BigDecimal) are now comparable to each other.
2009-09-23 18:54:01 +00:00
Joel Leitch
50eb582657
Ensure that the JsonElement.toString() will always generate valid JSON (even when control characters/whitespace characters are used).
2009-09-23 18:28:03 +00:00
Inderjeet Singh
3b0f8f4340
Removed all the JDK warnings about unused fields in test classes or unused constructors for use by Gson or instanceof calls on parameterized types.
2009-09-23 17:45:16 +00:00
Inderjeet Singh
29ab864b2f
Fixed bug 158
2009-09-23 17:17:03 +00:00
Joel Leitch
c5812bb485
Fixed Incorrect JavaDoc
2009-09-22 19:10:53 +00:00
Joel Leitch
18b301dfeb
- Serializing of Object arrays.
...
- Fixed incorrect warning
2009-09-22 19:04:27 +00:00
Inderjeet Singh
82771f006c
removed Java 1.5 warnings
2009-08-31 17:51:47 +00:00
Inderjeet Singh
66649a1a62
Moved ancestor tracking into the serialization visitor. Deserialization process doesn't need ancestor tracking since JSON does not allow self-referential structures.
2009-08-31 16:38:50 +00:00
Inderjeet Singh
c4c8a1c1a6
Updated version information in header
2009-08-24 17:22:31 +00:00
Inderjeet Singh
cbcf7defa3
Updated Grammar for matching JsonArray to be left-associative rather than right-associative. Gson can now parse arrays of size over 11MB instead of 80KB which was the prior limit. Thanks for the tip, kenotron.
2009-08-22 01:03:27 +00:00
Inderjeet Singh
c13fc568c7
Fixed indentation and simplified equals method as per code review comments on r419
2009-08-18 18:07:25 +00:00
Inderjeet Singh
f4f596ec3d
Made JsonParser implement Iterator
2009-08-12 21:01:42 +00:00
Inderjeet Singh
41a1f8b89e
Added tests in response to http://groups.google.com/group/google-gson/browse_thread/thread/41478d30b9f100b5
2009-08-10 17:47:11 +00:00
Inderjeet Singh
b7cbfc5c34
Fixed Issue 141 by adding new APIs for writing out JSON string representation for JsonElements.
2009-08-07 20:58:41 +00:00
Inderjeet Singh
03a3cc83c3
Attempt to reproduce issue 140
2009-08-07 01:12:41 +00:00
Inderjeet Singh
64172d1dac
Added support to serialize and deserialize array of java.lang.Object when the content is a primitive type.
2009-07-27 23:24:23 +00:00
Inderjeet Singh
d8095c72fd
minor improvements to the test
2009-07-14 01:08:04 +00:00
Inderjeet Singh
eac1beacc9
Added performance tests for byte array serialization and deserialization.
2009-07-13 22:27:55 +00:00
Inderjeet Singh
4f0728f6a0
Fixed issue 126 by ensuring that parameterized type deduction is not done for transient fields.
2009-06-02 18:02:15 +00:00
Inderjeet Singh
6d50bcea87
Added serialize and deserialize parameters to the Expose annotation that control whether a field gets exposed during serialization or deserialization.
2009-05-19 23:47:53 +00:00
Joel Leitch
376385ac0e
Add a single quote to the HTML set of characters that should be escaped.
2009-05-19 19:49:25 +00:00
Joel Leitch
cd9bd71092
Allow JS Keywords as field name. These names are quoted anyways (and are valid according to the JSON spec) so it should not cause any issues.
2009-05-19 17:59:32 +00:00
Joel Leitch
abf4ab2d78
Fix project so it still compiles with JDK 1.5.
2009-05-19 17:51:02 +00:00
Inderjeet Singh
6e59e502c2
Refactored the Async parser interface out of JsonParser into a new class JsonParserAsync. Updated the JsonParser to detect Eof and return a null instead of throwing a ParseException.
2009-05-14 20:18:45 +00:00
Inderjeet Singh
f2fd0b7d52
Fixed the typo in OSGi Bundle manifest and updated the version number to 1.4 to match the revised Gson version.
2009-05-08 22:24:26 +00:00
Inderjeet Singh
0127891081
Added a new API method in JsonParser to allow reading of multiple JSON objects on a stream asynchronously.
2009-05-08 22:22:34 +00:00
Inderjeet Singh
6b39f52f53
Added OSGi Bundle manifest headers to enable use of Gson in OSGi environments.
...
Fixes issue 120
2009-05-05 23:31:43 +00:00
Inderjeet Singh
b44bbbf5e7
Added an API method to create a tree of JsonElement from an object.
2009-04-03 21:33:01 +00:00
Inderjeet Singh
f418ab69a2
Implementing hashcode and equals for JsonPrimitives as value type equality.
2009-04-03 21:24:38 +00:00
Joel Leitch
f9b1225581
Commiting JavaDoc for the 1.3 Release.
2009-04-02 01:40:57 +00:00
Inderjeet Singh
84f0ddd6bb
Throwing a helpful error in cases where the user forgot to use the TypeToken idiom.
2009-04-01 22:24:10 +00:00
Joel Leitch
5c6d5a0d11
Remove unneeded exception handling in Gson class.
2009-04-01 19:26:10 +00:00
Inderjeet Singh
cee6c74960
incorporated code review comments from r379 by removing the catching of OutOfMemoryError and StackOverflowError in Gson.fromJson. This is obviated since JsonParser.parse catches these errors, and that was the primary source of these problems.
2009-04-01 17:15:01 +00:00
Joel Leitch
e9600e10cb
Made GregorianCalendarTypeAdapter consistent with the other default type adapters.
2009-04-01 17:07:23 +00:00
Inderjeet Singh
149604f0be
Made author tags consistent across the public api.
2009-04-01 17:03:31 +00:00
Joel Leitch
c8cb35e025
Adding copyright statement to JsonParserTest.
2009-04-01 16:56:40 +00:00
Inderjeet Singh
85f7c939f6
Renamed JsonParserImpl to JsonParserJavacc for clarity.
2009-03-31 17:58:35 +00:00
Inderjeet Singh
2034090b15
Changed version to 1.3
...
Made JsonParser.parse a non-static method.
2009-03-31 17:53:23 +00:00
Inderjeet Singh
8965d31ce9
made DEBUG final per the naming conventions.
2009-03-30 19:55:05 +00:00
Inderjeet Singh
e340801d25
Moved enum-related tests under EnumTest class.
2009-03-30 18:36:55 +00:00
Inderjeet Singh
4f727df749
Throwing JsonParseException when the user expected class doesn't match the JSON input during deserialization.
2009-03-27 23:17:46 +00:00
Joel Leitch
c9cb05fc72
Do not leak out a ClassCastException to our clients.
2009-03-27 19:43:33 +00:00
Inderjeet Singh
727dbcdd88
Fixed javadoc for toString() since we do not output valid Json for strings at the moment.
2009-03-20 18:06:52 +00:00
Inderjeet Singh
68f3899c1a
Updated the security token to make generated Json non-executable. Removed the unneeded <data> element at the end.
2009-03-20 18:02:35 +00:00
Inderjeet Singh
7e90d3a7b2
Updated version to 1.3b3 and revised javadocs. Released this version publicly.
2009-03-17 21:32:13 +00:00
Inderjeet Singh
b2b2e5dc0a
Implemented enhancement request from issue 42 by supporting a new GsonBuilder setting generateNonExecutableJson() that prefixes the generated JSON with some special text that makes the output non-executable javascript. Gson now recognizes this special text in the input while parsing the JSON in fromJson and filters it out, if present.
2009-03-17 21:15:10 +00:00
Inderjeet Singh
1c5785be57
Tests to reproduce issue 95. The tests currently pass so the bug will be marked as invalid.
2009-03-12 20:54:00 +00:00
Inderjeet Singh
4fc6400f5c
Fixed the test that broke while fixing issue 100 in r394 by using a TreeSet for SortedSets and HashSet for other kind of sets.
2009-03-12 18:17:14 +00:00
Inderjeet Singh
a595032a90
Fixed issue 100 by adding support for deserialization of collections of elements that do not implement Comparable.
2009-03-12 01:59:48 +00:00
Inderjeet Singh
3d1f7251c1
Added tests to reproduce issue 103. The tests pass at the moment, so we need more information in the bugreport.
2009-03-12 01:04:30 +00:00
Inderjeet Singh
8f456831d4
Fixed Issue 104 by making FieldNamingStrategy to be public and allowing FieldNamingStrategy to be set in GsonBuilder
2009-03-11 21:53:02 +00:00
Inderjeet Singh
809e3b5e21
Fixed bug 106 by adding custom serialization support for Gregorian Calendar.
2009-03-11 21:46:58 +00:00
Inderjeet Singh
16be7167ec
Updated Gson grammar to support floating point numbers without a +/- after the E. So, 1.234567899E8 is now accepted by Gson as a valid floating point number. This fixed the bug http://code.google.com/p/google-gson/issues/detail?id=94
...
Also, updated Gson to use Javacc 4.2.
2009-03-05 23:05:29 +00:00
Inderjeet Singh
18005bbae1
using consistent method name prefixes.
2009-03-03 22:37:26 +00:00
Inderjeet Singh
2c25fdd850
Added a test to measure performance of Gson on large collections. Gson's parser handled a collection of 1.4 million objects for serialization. For deserialization, the numbers were lower and Gson parser gave a stack overflow beyond a collection of 87,000 objects.
2009-03-03 22:20:59 +00:00
Inderjeet Singh
da8a1feee8
Added tests for the bugreport http://code.google.com/p/google-gson/issues/detail?id=99
2009-03-03 21:09:07 +00:00
Inderjeet Singh
d4a53ee2fc
Added tests to verify JsonParser and related methods in Gson.
2009-02-07 00:20:30 +00:00
Inderjeet Singh
9173a4dc63
missed these files
2009-02-06 19:37:39 +00:00
Inderjeet Singh
81b5ea2da4
updated javadocs to 1.3beta2
2009-02-06 19:32:56 +00:00
Inderjeet Singh
228fbb9b8b
reverting this file since we do not want to generate parser everytime maven is run.
2009-02-04 02:02:31 +00:00
Inderjeet Singh
2c7cc620d4
Exposed API for JsonParser and added methods to Gson to deserialize from a parse tree.
2009-02-04 01:56:28 +00:00
Inderjeet Singh
f4c21abda6
updated javadoc in response to issue 97
2009-01-29 02:43:36 +00:00
Joel Leitch
764e4d9aca
Performance fixes after doing some profiling.
2009-01-20 08:38:21 +00:00
Joel Leitch
6a80791f13
Code cleanup and some minor performance fixes.
2009-01-20 01:36:54 +00:00
Joel Leitch
2cec661ff0
Removing some unnecessary code.
2009-01-20 01:00:59 +00:00
Joel Leitch
d34fb916cb
Added tests for enum serialization and derserialization.
2009-01-20 00:52:54 +00:00
Joel Leitch
47b67390fa
Set the DEBUG bit back to false.
2009-01-17 22:34:57 +00:00
Joel Leitch
f4f92a699d
Added test for pretty printing of Maps.
2009-01-17 22:32:59 +00:00
Joel Leitch
e8619405be
Updating LICENSE file dates.
2009-01-12 17:31:30 +00:00
Joel Leitch
9c05adf0fd
Committing JavaDoc changes for the 1.3 Beta release.
2009-01-12 17:28:53 +00:00
Joel Leitch
0b1ee35784
Code review suggestions for r361
2009-01-12 17:10:50 +00:00
Joel Leitch
6620786642
Added Copyright statement.
2009-01-11 06:18:08 +00:00
Joel Leitch
e2cfc0cc19
Update GsonBuilder API to accept an enum for the serialize Long as string. This will be useful if/when we implement support to serialize a long type as an array of integers.
2009-01-11 06:11:29 +00:00
Joel Leitch
90a4619034
Minor fixes for pretty printing.
2009-01-11 05:01:23 +00:00
Joel Leitch
02decace26
Added the ability to deserialize a Map "key" object from a String into a complex Java type.
2009-01-06 07:09:19 +00:00
Inderjeet Singh
970446e997
replaced system.out.println with a real assertion in the test.
2008-12-31 01:15:15 +00:00
Inderjeet Singh
cc334475b0
Fixed issue 87 by adding support for deserialization of java.util.Properties
2008-12-31 01:01:57 +00:00
Inderjeet Singh
6fe2fdf7a0
test to reproduce issue 87
2008-12-31 00:43:40 +00:00
Inderjeet Singh
3690d362b9
incorporated feedback from r358
2008-12-30 22:42:36 +00:00
Inderjeet Singh
e839336eea
Incorporated comments from the code review r355
2008-12-30 19:03:43 +00:00
Inderjeet Singh
05f54f3552
Incorporated code review comments from r350
2008-12-30 18:54:33 +00:00
Joel Leitch
9612bb3601
Removing test file that I didn't mean to add in r355.
2008-12-28 23:14:44 +00:00
Joel Leitch
73d93e3322
Provide a setting to allow a client to skip the escaping of special HTML characters.
...
As well, remove the "/" from the list of special HTML characters since it is causing some incompatibilities.
2008-12-28 23:05:22 +00:00
Joel Leitch
1c87bd5993
Some minor update to our JavaDoc
2008-12-28 06:51:11 +00:00
Joel Leitch
f923f7f537
Add "@since" JavaDoc to the new methods in GsonBuilder.
2008-12-28 03:35:07 +00:00
Joel Leitch
458f2baa2f
Added special serialization of "Long". Now the client has the ability to output a long field as a JSON "String". This is useful for JavaScript clients that need to handle long values.
...
As well, this change does a major clean up of the custom type adapter handling and ParameterizedTypeMap creation.
2008-12-28 03:23:36 +00:00
Joel Leitch
859af0025c
Implement suggestions from self review of r350.
2008-12-28 02:05:40 +00:00
Joel Leitch
54a480774d
Add the ability to configure Gson to exclude serializing and deserializing of all "Inner Classes".
2008-12-28 02:00:31 +00:00
Joel Leitch
73117fe652
Wrapping UUID deserializer in exception wrapper to make it consistent with other deserializers
2008-12-28 00:00:12 +00:00
Joel Leitch
911a92bff9
Removal of all unnecessary "Default" InstanceCreators. While refactoring the code, I found a bug that these InstanceCreators were being called when inside an "Array". This bug is fixed in this change.
2008-12-27 23:43:16 +00:00
Inderjeet Singh
bc6ec50db9
incorporated fixes from code review of r341
2008-12-23 18:24:13 +00:00
Inderjeet Singh
e0195fcc54
code review changes from r342
...
Enabled escaping of /
2008-12-23 18:18:14 +00:00
Inderjeet Singh
51881c7f4a
Added a GsonBuilder setting to enable serialization of special double types, NaN, Infinity, and -Infinity.
2008-12-20 01:26:14 +00:00
Inderjeet Singh
362a94ec74
Added deserialization support for Double NaN, Infinity, and -Infinity
2008-12-19 22:21:35 +00:00
Inderjeet Singh
f33a84c223
Added tests for ensuring that control characters are escaped by Gson.
2008-12-19 20:58:58 +00:00
Inderjeet Singh
e4fdea0fc1
Updated Gson escaper to not escape unicode characters. This is in response to Issue 80.
2008-12-19 20:41:53 +00:00
Inderjeet Singh
53f7d26b6d
removed tests for serialization of BigDecimal NaN, positive and negative infinity since BigDecimal can not be created with these values.
2008-12-19 17:46:24 +00:00
Inderjeet Singh
f7e4d5e4bb
Added checks to ensure that we do not serialize NaN or postiive or negative infinity for BigDecimal.
2008-12-18 23:56:38 +00:00
Inderjeet Singh
fce34ea057
updating the version number to 1.3 since we have a lot of API changes in the upcoming release.
2008-12-18 23:43:21 +00:00
Inderjeet Singh
40cf34a4cd
reverting the two files that should not have been committed in r337
2008-12-18 23:42:44 +00:00
Inderjeet Singh
6dbdb272c0
Added checks to ensure that we do not serialize NaN or postiive or negative infinity for floats.
2008-12-18 23:41:44 +00:00
Joel Leitch
09720f28cf
Incorporated changes from r307 code review
2008-12-18 20:21:05 +00:00
Joel Leitch
a18a751240
Share the same JsonNull instance with the Gson code.
2008-12-18 20:14:29 +00:00
Joel Leitch
17256b8ce5
Added tests for JsonPrimitive object creation with a char type.
...
Suggestion from r321 code review.
2008-12-18 20:06:20 +00:00
Inderjeet Singh
cbc6b4d939
Added checks to ensure that we do not serialize NaN or postiive or negative infinity for doubles.
2008-12-18 20:00:27 +00:00
Joel Leitch
0993d729e4
Added @since to the JavaDoc for the new methods added to JsonElement.
...
Suggested in the r296 code review.
2008-12-18 19:25:22 +00:00
Inderjeet Singh
de713614af
incorporated feedback from code review of r295
2008-12-18 18:59:30 +00:00
Joel Leitch
fc65667d2f
Add support for wildcard type on Maps, Collections and other parameterized types.
2008-12-14 07:12:04 +00:00
Joel Leitch
8e1c6a2b37
Ensure that BigDecimals fields are properly converted into its string representation.
2008-12-14 05:56:41 +00:00
Joel Leitch
ea79cd6812
Allow booleans and number to be deserialized into a "String" field/object.
2008-12-14 04:42:16 +00:00
Joel Leitch
0b5f3dc825
Added UUID as a default type supported by Gson.
2008-12-13 20:42:31 +00:00
Joel Leitch
d16553701b
Performing automatic refactoring using the IDE tools which does not take resources into consideration. This fixes the JavaCC Parser definition.
...
Goes with r325.
2008-12-02 23:48:10 +00:00
Joel Leitch
11a29b63b0
Implemented suggested changes from r324 code review.
2008-12-02 23:41:04 +00:00
Joel Leitch
b9e81f93c1
Fixed warnings and updated some JavaDoc.
2008-12-01 01:40:11 +00:00
Joel Leitch
50dd475eb8
Added more tests involving Since and Until versioning.
2008-12-01 00:23:35 +00:00
Joel Leitch
6f59bc3bfe
Added "Until" type version. This new annotation allows you to remove members from the JSON output beginning at a certain version number.
...
This new annotation work in conjunction with the "@Since" annotation.
2008-12-01 00:10:04 +00:00
Joel Leitch
5ae7e1f803
Adding new convenience method to JsonObject for adding Booleans and Characters.
2008-11-30 23:36:29 +00:00
Joel Leitch
b90228dcc0
Enable serialization of nulls within Maps.
2008-11-30 23:01:14 +00:00
Joel Leitch
a82c400dc8
Fix warnings.
2008-11-30 00:47:07 +00:00
Joel Leitch
c9e48097ec
Do not overwrite a duplicate field value during seriailzation if one those fields is null.
2008-11-27 00:50:50 +00:00
Joel Leitch
b506183d94
Move isPrimitiveOrString() method from ObjectNavigator to JsonPrimitive.
2008-11-27 00:40:31 +00:00
Joel Leitch
d6d1daeedd
Submitting @Expose tests with interfaces.
2008-11-26 21:46:55 +00:00
Inderjeet Singh
9bcbb4cfdc
Fixed issue 52 by switching Gson.toJson methods to use Appendable instead of java.io.Writer
2008-11-26 19:13:14 +00:00
Inderjeet Singh
59be02d4de
Added support for accepting Object field names without quotes. Issue 41.
2008-11-26 17:52:46 +00:00
Inderjeet Singh
7334a33d14
Test to verify support for object member names without quotes (see Issue 41).
2008-11-26 17:49:35 +00:00