com.urbanairship.api.push.parse.PushOptionsReader 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
/*
* Copyright (c) 2013-2016. Urban Airship and Contributors
*/
package com.urbanairship.api.push.parse;
import com.fasterxml.jackson.core.JsonParser;
import com.urbanairship.api.common.parse.BooleanFieldDeserializer;
import com.urbanairship.api.common.parse.JsonObjectReader;
import com.urbanairship.api.push.model.PushExpiry;
import com.urbanairship.api.push.model.PushOptions;
import java.io.IOException;
public class PushOptionsReader implements JsonObjectReader {
private final PushOptions.Builder builder;
public PushOptionsReader() {
this.builder = PushOptions.newBuilder();
}
public void readExpiry(JsonParser parser) throws IOException {
builder.setExpiry(parser.readValueAs(PushExpiry.class));
}
public void readNoThrottle(JsonParser parser) throws IOException {
builder.setNoThrottle(BooleanFieldDeserializer.INSTANCE.deserialize(parser, "no_throttle"));
}
public void readPersonalization(JsonParser parser) throws IOException {
builder.setPersonalization(BooleanFieldDeserializer.INSTANCE.deserialize(parser, "personalization"));
}
@Override
public PushOptions validateAndBuild() throws IOException {
return builder.build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy