Example usage for com.google.gson.stream JsonToken NULL

List of usage examples for com.google.gson.stream JsonToken NULL

Introduction

In this page you can find the example usage for com.google.gson.stream JsonToken NULL.

Prototype

JsonToken NULL

To view the source code for com.google.gson.stream JsonToken NULL.

Click Source Link

Document

A JSON null .

Usage

From source file:DateMidnightTypeAdapter.java

License:Apache License

@Override
public DateMidnight read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();//from  w  w w  .  ja  v a  2 s.  c om
        return null;
    }
    return new DateMidnight(in.nextString());
}

From source file:MonthDayTypeAdapter.java

License:Apache License

@Override
public MonthDay read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();/*from   w w  w  .  j  av a  2s.  c om*/
        return null;
    }
    return MonthDay.parse(in.nextString());
}

From source file:LocalDateTimeTypeAdapter.java

License:Apache License

@Override
public LocalDateTime read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();//from w ww. j  a va  2s.c  o m
        return null;
    }
    return new LocalDateTime(in.nextString());
}

From source file:PeriodTypeAdapter.java

License:Apache License

@Override
public Period read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();/*ww w  .  ja  v  a 2  s . co  m*/
        return null;
    }
    return new Period(in.nextString());
}

From source file:InstantTypeAdapter.java

License:Apache License

@Override
public Instant read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();/*from w  w  w. j  a  va2s.  c  o m*/
        return null;
    }
    return new Instant(in.nextString());
}

From source file:LocalDateTypeAdapter.java

License:Apache License

@Override
public LocalDate read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();//www  . j av  a2  s . co  m
        return null;
    }
    return new LocalDate(in.nextString());
}

From source file:LocalTimeTypeAdapter.java

License:Apache License

@Override
public LocalTime read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();// w  w  w  . j  a v  a  2  s.c om
        return null;
    }
    return new LocalTime(in.nextString());
}

From source file:YearMonthTypeAdapter.java

License:Apache License

@Override
public YearMonth read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();//from w  ww .  j  av  a  2 s  .c  o m
        return null;
    }
    return new YearMonth(in.nextString());
}

From source file:DateTimeTypeAdapter.java

License:Apache License

@Override
public DateTime read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();/*ww  w.java 2  s  .c o  m*/
        return null;
    }
    return new DateTime(in.nextString());
}

From source file:DurationTypeAdapter.java

License:Apache License

@Override
public Duration read(JsonReader in) throws IOException {
    if (in.peek() == JsonToken.NULL) {
        in.nextNull();//ww  w. ja  v  a2  s  .com
        return null;
    }
    return new Duration(in.nextString());
}