All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.urbanairship.api.push.parse.notification.web.WebIconReader Maven / Gradle / Ivy

There is a newer version: 9.3.0
Show newest version
package com.urbanairship.api.push.parse.notification.web;

import com.fasterxml.jackson.core.JsonParser;
import com.urbanairship.api.common.parse.APIParsingException;
import com.urbanairship.api.common.parse.JsonObjectReader;
import com.urbanairship.api.common.parse.StringFieldDeserializer;
import com.urbanairship.api.push.model.notification.web.WebIcon;

import java.io.IOException;

public class WebIconReader implements JsonObjectReader {

    private final WebIcon.Builder builder;

    public WebIconReader() {
        this.builder = WebIcon.newBuilder();
    }

    public WebIcon validateAndBuild() throws IOException {
        try {
            return builder.build();
        } catch (Exception e) {
            throw new APIParsingException(e.getMessage(), e);
        }
    }

    public void readUrl(JsonParser parser) throws IOException {
        builder.setUrl(StringFieldDeserializer.INSTANCE.deserialize(parser, "url"));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy