Merge pull request #144 from ersin-ertan/master

Add java to java-less '''
This commit is contained in:
Jake Wharton
2016-03-24 18:56:25 -04:00

View File

@@ -365,7 +365,7 @@ shouldnt need this `@JsonQualifier`, but its very handy for those that do.
Some models declare fields that shouldnt be included in JSON. For example, suppose our blackjack Some models declare fields that shouldnt be included in JSON. For example, suppose our blackjack
hand has a `total` field with the sum of the cards: hand has a `total` field with the sum of the cards:
``` ```java
public final class BlackjackHand { public final class BlackjackHand {
private int total; private int total;
@@ -376,7 +376,7 @@ public final class BlackjackHand {
By default, all fields are emitted when encoding JSON, and all fields are accepted when decoding By default, all fields are emitted when encoding JSON, and all fields are accepted when decoding
JSON. Prevent a field from being included by adding Javas `transient` keyword: JSON. Prevent a field from being included by adding Javas `transient` keyword:
``` ```java
public final class BlackjackHand { public final class BlackjackHand {
private transient int total; private transient int total;
@@ -397,7 +397,7 @@ If the class has a no-arguments constructor, Moshi will call that constructor an
it assigns will be used. For example, because this class has a no-arguments constructor the `total` it assigns will be used. For example, because this class has a no-arguments constructor the `total`
field is initialized to `-1`. field is initialized to `-1`.
``` ```java
public final class BlackjackHand { public final class BlackjackHand {
private int total = -1; private int total = -1;
... ...
@@ -416,7 +416,7 @@ If the class doesnt have a no-arguments constructor, Moshi cant assign the
numbers, `false` for booleans, and `null` for references. In this example, the default value of numbers, `false` for booleans, and `null` for references. In this example, the default value of
`total` is `0`! `total` is `0`!
``` ```java
public final class BlackjackHand { public final class BlackjackHand {
private int total = -1; private int total = -1;
... ...
@@ -431,7 +431,7 @@ This is surprising and is a potential source of bugs! For this reason consider d
no-arguments constructor in classes that you use with Moshi, using `@SuppressWarnings("unused")` to no-arguments constructor in classes that you use with Moshi, using `@SuppressWarnings("unused")` to
prevent it from being inadvertently deleted later: prevent it from being inadvertently deleted later:
``` ```java
public final class BlackjackHand { public final class BlackjackHand {
private int total = -1; private int total = -1;
... ...