Change URLs from http to https (#1521)
* Change URLs from http to https * Changed github.io to javadoc
This commit is contained in:
parent
f426700bc4
commit
f07fa51200
|
@ -35,12 +35,12 @@ Maven:
|
||||||
[![Build Status](https://travis-ci.org/google/gson.svg?branch=master)](https://travis-ci.org/google/gson)
|
[![Build Status](https://travis-ci.org/google/gson.svg?branch=master)](https://travis-ci.org/google/gson)
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
* [API Javadoc](http://www.javadoc.io/doc/com.google.code.gson/gson): Documentation for the current release
|
* [API Javadoc](https://www.javadoc.io/doc/com.google.code.gson/gson): Documentation for the current release
|
||||||
* [User guide](https://github.com/google/gson/blob/master/UserGuide.md): This guide contains examples on how to use Gson in your code.
|
* [User guide](https://github.com/google/gson/blob/master/UserGuide.md): This guide contains examples on how to use Gson in your code.
|
||||||
* [Change log](https://github.com/google/gson/blob/master/CHANGELOG.md): Changes in the recent versions
|
* [Change log](https://github.com/google/gson/blob/master/CHANGELOG.md): Changes in the recent versions
|
||||||
* [Design document](https://github.com/google/gson/blob/master/GsonDesignDocument.md): This document discusses issues we faced while designing Gson. It also includes a comparison of Gson with other Java libraries that can be used for Json conversion
|
* [Design document](https://github.com/google/gson/blob/master/GsonDesignDocument.md): This document discusses issues we faced while designing Gson. It also includes a comparison of Gson with other Java libraries that can be used for Json conversion
|
||||||
|
|
||||||
Please use the 'gson' tag on StackOverflow or the [google-gson Google group](http://groups.google.com/group/google-gson) to discuss Gson or to post questions.
|
Please use the 'gson' tag on StackOverflow or the [google-gson Google group](https://groups.google.com/group/google-gson) to discuss Gson or to post questions.
|
||||||
|
|
||||||
### Related Content Created by Third Parties
|
### Related Content Created by Third Parties
|
||||||
* [Gson Tutorial](http://www.studytrails.com/java/json/java-google-json-introduction.jsp) by `StudyTrails`
|
* [Gson Tutorial](http://www.studytrails.com/java/json/java-google-json-introduction.jsp) by `StudyTrails`
|
||||||
|
|
|
@ -17,15 +17,15 @@ The following is a step-by-step procedure for releasing a new version of Google-
|
||||||
|
|
||||||
1. Update the version in the [Using Gson with Maven2 page](https://github.com/google/gson/blob/master/UserGuide.md#TOC-Gson-With-Maven)
|
1. Update the version in the [Using Gson with Maven2 page](https://github.com/google/gson/blob/master/UserGuide.md#TOC-Gson-With-Maven)
|
||||||
1. Update [Gson Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md). Also, look at all bugs that were fixed and add a few lines describing what changed in the release.
|
1. Update [Gson Changelog](https://github.com/google/gson/blob/master/CHANGELOG.md). Also, look at all bugs that were fixed and add a few lines describing what changed in the release.
|
||||||
1. Create a post on the [Gson Discussion Forum](http://groups.google.com/group/google-gson)
|
1. Create a post on the [Gson Discussion Forum](https://groups.google.com/group/google-gson)
|
||||||
1. Update the release version in [Wikipedia](http://en.wikipedia.org/wiki/GSON) and update the current "stable" release.
|
1. Update the release version in [Wikipedia](https://en.wikipedia.org/wiki/GSON) and update the current "stable" release.
|
||||||
|
|
||||||
## Configuring a machine for deployment to Sonatype Repository
|
## Configuring a machine for deployment to Sonatype Repository
|
||||||
|
|
||||||
This section was borrowed heavily from [Doclava release process](http://code.google.com/p/doclava/wiki/ProcessRelease).
|
This section was borrowed heavily from [Doclava release process](https://code.google.com/archive/p/doclava/wikis/ProcessRelease.wiki).
|
||||||
|
|
||||||
1. Install/Configure GPG following this [guide](http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/).
|
1. Install/Configure GPG following this [guide](https://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven/).
|
||||||
1. [Create encrypted passwords](http://maven.apache.org/guides/mini/guide-encryption.html).
|
1. [Create encrypted passwords](https://maven.apache.org/guides/mini/guide-encryption.html).
|
||||||
1. Create `~/.m2/settings.xml` similar to as described in [Doclava release process](https://code.google.com/p/doclava/wiki/ProcessRelease).
|
1. Create `~/.m2/settings.xml` similar to as described in [Doclava release process](https://code.google.com/p/doclava/wiki/ProcessRelease).
|
||||||
1. Now for deploying a snapshot repository, use `mvn deploy`.
|
1. Now for deploying a snapshot repository, use `mvn deploy`.
|
||||||
|
|
||||||
|
|
10
UserGuide.md
10
UserGuide.md
|
@ -250,7 +250,7 @@ gson.fromJson(json, foo.getClass()); // Fails to deserialize foo.value as Bar
|
||||||
|
|
||||||
The above code fails to interpret value as type Bar because Gson invokes `list.getClass()` to get its class information, but this method returns a raw class, `Foo.class`. This means that Gson has no way of knowing that this is an object of type `Foo<Bar>`, and not just plain `Foo`.
|
The above code fails to interpret value as type Bar because Gson invokes `list.getClass()` to get its class information, but this method returns a raw class, `Foo.class`. This means that Gson has no way of knowing that this is an object of type `Foo<Bar>`, and not just plain `Foo`.
|
||||||
|
|
||||||
You can solve this problem by specifying the correct parameterized type for your generic type. You can do this by using the [`TypeToken`](http://google.github.io/gson/apidocs/com/google/gson/reflect/TypeToken.html) class.
|
You can solve this problem by specifying the correct parameterized type for your generic type. You can do this by using the [`TypeToken`](https://static.javadoc.io/com.google.code.gson/gson/2.8.5/com/google/gson/reflect/TypeToken.html) class.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Type fooType = new TypeToken<Foo<Bar>>() {}.getType();
|
Type fooType = new TypeToken<Foo<Bar>>() {}.getType();
|
||||||
|
@ -556,7 +556,7 @@ This feature provides a way where you can mark certain fields of your objects to
|
||||||
|
|
||||||
#### <a name="TOC-User-Defined-Exclusion-Strategies"></a>User Defined Exclusion Strategies
|
#### <a name="TOC-User-Defined-Exclusion-Strategies"></a>User Defined Exclusion Strategies
|
||||||
|
|
||||||
If the above mechanisms for excluding fields and class type do not work for you then you can always write your own exclusion strategy and plug it into Gson. See the [`ExclusionStrategy`](http://google.github.io/gson/apidocs/com/google/gson/ExclusionStrategy.html) JavaDoc for more information.
|
If the above mechanisms for excluding fields and class type do not work for you then you can always write your own exclusion strategy and plug it into Gson. See the [`ExclusionStrategy`](https://static.javadoc.io/com.google.code.gson/gson/2.8.5/com/google/gson/ExclusionStrategy.html) JavaDoc for more information.
|
||||||
|
|
||||||
The following example shows how to exclude fields marked with a specific `@Foo` annotation and excludes top-level types (or declared field type) of class `String`.
|
The following example shows how to exclude fields marked with a specific `@Foo` annotation and excludes top-level types (or declared field type) of class `String`.
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ The output is:
|
||||||
|
|
||||||
### <a name="TOC-JSON-Field-Naming-Support"></a>JSON Field Naming Support
|
### <a name="TOC-JSON-Field-Naming-Support"></a>JSON Field Naming Support
|
||||||
|
|
||||||
Gson supports some pre-defined field naming policies to convert the standard Java field names (i.e., camel cased names starting with lower case --- `sampleFieldNameInJava`) to a Json field name (i.e., `sample_field_name_in_java` or `SampleFieldNameInJava`). See the [FieldNamingPolicy](http://google.github.io/gson/apidocs/com/google/gson/FieldNamingPolicy.html) class for information on the pre-defined naming policies.
|
Gson supports some pre-defined field naming policies to convert the standard Java field names (i.e., camel cased names starting with lower case --- `sampleFieldNameInJava`) to a Json field name (i.e., `sample_field_name_in_java` or `SampleFieldNameInJava`). See the [FieldNamingPolicy](https://static.javadoc.io/com.google.code.gson/gson/2.8.5/com/google/gson/FieldNamingPolicy.html) class for information on the pre-defined naming policies.
|
||||||
|
|
||||||
It also has an annotation based strategy to allows clients to define custom names on a per field basis. Note, that the annotation based strategy has field name validation which will raise "Runtime" exceptions if an invalid field name is provided as the annotation value.
|
It also has an annotation based strategy to allows clients to define custom names on a per field basis. Note, that the annotation based strategy has field name validation which will raise "Runtime" exceptions if an invalid field name is provided as the annotation value.
|
||||||
|
|
||||||
|
@ -644,11 +644,11 @@ The output is:
|
||||||
{"custom_naming":"first","SomeOtherField":"second"}
|
{"custom_naming":"first","SomeOtherField":"second"}
|
||||||
```
|
```
|
||||||
|
|
||||||
If you have a need for custom naming policy ([see this discussion](http://groups.google.com/group/google-gson/browse_thread/thread/cb441a2d717f6892)), you can use the [@SerializedName](http://google.github.io/gson/apidocs/com/google/gson/annotations/SerializedName.html) annotation.
|
If you have a need for custom naming policy ([see this discussion](https://groups.google.com/group/google-gson/browse_thread/thread/cb441a2d717f6892)), you can use the [@SerializedName](https://static.javadoc.io/com.google.code.gson/gson/2.8.5/com/google/gson/annotations/SerializedName.html) annotation.
|
||||||
|
|
||||||
### <a name="TOC-Sharing-State-Across-Custom-Serializers-and-Deserializers"></a>Sharing State Across Custom Serializers and Deserializers
|
### <a name="TOC-Sharing-State-Across-Custom-Serializers-and-Deserializers"></a>Sharing State Across Custom Serializers and Deserializers
|
||||||
|
|
||||||
Sometimes you need to share state across custom serializers/deserializers ([see this discussion](http://groups.google.com/group/google-gson/browse_thread/thread/2850010691ea09fb)). You can use the following three strategies to accomplish this:
|
Sometimes you need to share state across custom serializers/deserializers ([see this discussion](https://groups.google.com/group/google-gson/browse_thread/thread/2850010691ea09fb)). You can use the following three strategies to accomplish this:
|
||||||
|
|
||||||
1. Store shared state in static fields
|
1. Store shared state in static fields
|
||||||
2. Declare the serializer/deserializer as inner classes of a parent type, and use the instance fields of parent type to store shared state
|
2. Declare the serializer/deserializer as inner classes of a parent type, and use the instance fields of parent type to store shared state
|
||||||
|
|
Loading…
Reference in New Issue
Block a user