Example usage for com.google.gson.stream JsonReader nextNull

List of usage examples for com.google.gson.stream JsonReader nextNull

Introduction

In this page you can find the example usage for com.google.gson.stream JsonReader nextNull.

Prototype

public void nextNull() throws IOException 

Source Link

Document

Consumes the next token from the JSON stream and asserts that it is a literal null.

Usage

From source file:com.vimeo.stag.generated.ParseUtils.java

public static VimeoAccount parseVimeoAccount(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }/* ww w . j  a  v a  2 s  .com*/
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.VimeoAccount object = new com.vimeo.networking.model.VimeoAccount();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "access_token":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.accessToken = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "token_type":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.tokenType = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "scope":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.scope = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "user":
            try {
                object.user = ParseUtils.parseUser(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing VimeoAccount.user JSON!", exception);
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static VodItem.Publish parsePublish(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }//from w w  w . ja v a 2s .c  o  m
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.VodItem.Publish object = new com.vimeo.networking.model.VodItem.Publish();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "time":
            try {
                object.mTime = Stag.readFromAdapter(gson, java.util.Date.class, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing Publish.mTime JSON!", exception);
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static UploadQuota parseUploadQuota(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }//from   ww  w. j a v a 2  s.  c  o  m
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.UploadQuota object = new com.vimeo.networking.model.UploadQuota();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "quota":
            try {
                object.quota = ParseUtils.parseQuota(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing UploadQuota.quota JSON!", exception);
            }
            break;
        case "space":
            try {
                object.space = ParseUtils.parseSpace(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing UploadQuota.space JSON!", exception);
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static PictureResource parsePictureResource(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }//from   ww  w  .j a  v  a 2 s  .  c  o m
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.PictureResource object = new com.vimeo.networking.model.PictureResource();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "uri":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.uri = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "active":
            if (jsonToken == com.google.gson.stream.JsonToken.BOOLEAN) {
                object.active = reader.nextBoolean();
            } else {
                reader.skipValue();
            }
            break;
        case "link":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.link = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static PinCodeInfo parsePinCodeInfo(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }//from   w ww  .  j av  a 2s . c  om
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.PinCodeInfo object = new com.vimeo.networking.model.PinCodeInfo();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "authorize_link":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.mAuthorizeLink = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "expires_in":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.expiresIn = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        case "user_code":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.mUserCode = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "activate_link":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.mActivateLink = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "device_code":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.mDeviceCode = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "interval":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.interval = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static SearchFacetCollection parseSearchFacetCollection(Gson gson, JsonReader reader)
        throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }/*  w  w w  .  ja v a2  s. c  o m*/
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.search.SearchFacetCollection object = new com.vimeo.networking.model.search.SearchFacetCollection();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "type":
            try {
                object.mTypeFacet = ParseUtils.parseSearchFacet(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing SearchFacetCollection.mTypeFacet JSON!", exception);
            }
            break;
        case "user_type":
            try {
                object.mUserTypeFacet = ParseUtils.parseSearchFacet(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing SearchFacetCollection.mUserTypeFacet JSON!", exception);
            }
            break;
        case "duration":
            try {
                object.mDurationFacet = ParseUtils.parseSearchFacet(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing SearchFacetCollection.mDurationFacet JSON!", exception);
            }
            break;
        case "category":
            try {
                object.mCategoryFacet = ParseUtils.parseSearchFacet(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing SearchFacetCollection.mCategoryFacet JSON!", exception);
            }
            break;
        case "license":
            try {
                object.mLicenseFacet = ParseUtils.parseSearchFacet(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing SearchFacetCollection.mLicenseFacet JSON!", exception);
            }
            break;
        case "uploaded":
            try {
                object.mUploadedFacet = ParseUtils.parseSearchFacet(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing SearchFacetCollection.mUploadedFacet JSON!", exception);
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static Drm parseDrm(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }//from  ww  w  .  jav  a2  s. com
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.playback.Drm object = new com.vimeo.networking.model.playback.Drm();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "widevine":
            try {
                object.mWidevine = ParseUtils.parseVideoFile(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing Drm.mWidevine JSON!", exception);
            }
            break;
        case "playready":
            try {
                object.mPlayReady = ParseUtils.parseVideoFile(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing Drm.mPlayReady JSON!", exception);
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static VideosPreference parseVideosPreference(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }/*from   w w  w  .java 2 s.c om*/
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.VideosPreference object = new com.vimeo.networking.model.VideosPreference();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "privacy":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.privacy = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        case "password":
            if (jsonToken == com.google.gson.stream.JsonToken.STRING) {
                object.password = reader.nextString();
            } else {
                reader.skipValue();
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static SearchResponse parseSearchResponse(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }/*from w ww  .j a va2 s.c  o  m*/
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.search.SearchResponse object = new com.vimeo.networking.model.search.SearchResponse();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "total":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.total = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        case "per_page":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.perPage = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        case "page":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.page = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        case "mature_hidden_count":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.mMatureHiddenCount = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        case "paging":
            try {
                object.paging = ParseUtils.parsePaging(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing SearchResponse.paging JSON!", exception);
            }
            break;
        case "facets":
            try {
                object.mFacetCollection = ParseUtils.parseSearchFacetCollection(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing SearchResponse.mFacetCollection JSON!", exception);
            }
            break;
        case "data":
            if (jsonToken == com.google.gson.stream.JsonToken.BEGIN_ARRAY) {
                object.data = ParseUtils.parseArray(gson, reader,
                        com.vimeo.networking.model.search.SearchResult.class);
            } else {
                reader.skipValue();
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}

From source file:com.vimeo.stag.generated.ParseUtils.java

public static UserList parseUserList(Gson gson, JsonReader reader) throws IOException {
    if (reader.peek() == com.google.gson.stream.JsonToken.NULL) {
        reader.nextNull();
        return null;
    }/*from w w w  .  j  a  v a 2 s . co m*/
    if (reader.peek() != com.google.gson.stream.JsonToken.BEGIN_OBJECT) {
        reader.skipValue();
        return null;
    }
    reader.beginObject();

    com.vimeo.networking.model.UserList object = new com.vimeo.networking.model.UserList();
    while (reader.hasNext()) {
        String name = reader.nextName();
        com.google.gson.stream.JsonToken jsonToken = reader.peek();
        if (jsonToken == com.google.gson.stream.JsonToken.NULL) {
            reader.skipValue();
            continue;
        }
        switch (name) {
        case "total":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.total = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        case "per_page":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.perPage = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        case "page":
            if (jsonToken == com.google.gson.stream.JsonToken.NUMBER) {
                object.page = reader.nextInt();
            } else {
                reader.skipValue();
            }
            break;
        case "data":
            if (jsonToken == com.google.gson.stream.JsonToken.BEGIN_ARRAY) {
                object.data = ParseUtils.parseArray(gson, reader, com.vimeo.networking.model.User.class);
            } else {
                reader.skipValue();
            }
            break;
        case "paging":
            try {
                object.paging = ParseUtils.parsePaging(gson, reader);
            } catch (Exception exception) {
                throw new IOException("Error parsing UserList.paging JSON!", exception);
            }
            break;
        default:
            reader.skipValue();
            break;
        }
    }

    reader.endObject();
    return object;
}