com.urbanairship.api.push.parse.notification.web.WebDevicePayloadReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
The Urban Airship Java client library
package com.urbanairship.api.push.parse.notification.web;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.urbanairship.api.common.parse.APIParsingException;
import com.urbanairship.api.common.parse.BooleanFieldDeserializer;
import com.urbanairship.api.common.parse.JsonObjectReader;
import com.urbanairship.api.common.parse.MapOfStringsDeserializer;
import com.urbanairship.api.common.parse.StringFieldDeserializer;
import com.urbanairship.api.push.model.PushExpiry;
import com.urbanairship.api.push.model.notification.actions.Actions;
import com.urbanairship.api.push.model.notification.web.Button;
import com.urbanairship.api.push.model.notification.web.WebDevicePayload;
import com.urbanairship.api.push.model.notification.web.WebIcon;
import com.urbanairship.api.push.model.notification.web.WebImage;
import com.urbanairship.api.push.model.notification.web.WebTemplate;
import java.io.IOException;
import java.util.List;
public class WebDevicePayloadReader implements JsonObjectReader {
private WebDevicePayload.Builder builder;
public WebDevicePayloadReader() {
this.builder = WebDevicePayload.newBuilder();
}
public void readAlert(JsonParser parser) throws IOException {
builder.setAlert(StringFieldDeserializer.INSTANCE.deserialize(parser, "alert"));
}
public void readTitle(JsonParser parser) throws IOException {
builder.setTitle(StringFieldDeserializer.INSTANCE.deserialize(parser, "title"));
}
public void readExtra(JsonParser parser) throws IOException {
builder.addAllExtraEntries(MapOfStringsDeserializer.INSTANCE.deserialize(parser, "extra"));
}
public void readWebIcon(JsonParser parser) throws IOException {
builder.setWebIcon(parser.readValueAs(WebIcon.class));
}
public void readRequireInteraction(JsonParser parser) throws IOException {
builder.setRequireInteraction(BooleanFieldDeserializer.INSTANCE.deserialize(parser, "require_interaction"));
}
public void readActions(JsonParser parser) throws IOException {
builder.setActions(parser.readValueAs(Actions.class));
}
public void readWebImage(JsonParser parser) throws IOException {
builder.setWebImage(parser.readValueAs(WebImage.class));
}
public void readExpiry(JsonParser parser) throws IOException {
builder.setExpiry(parser.readValueAs(PushExpiry.class));
}
public void readButtons(JsonParser parser) throws IOException {
List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy