com.urbanairship.api.push.parse.audience.location.SegmentDefinitionReader 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.audience.location;
import com.fasterxml.jackson.core.JsonParser;
import com.urbanairship.api.common.parse.JsonObjectReader;
import com.urbanairship.api.common.parse.StringFieldDeserializer;
import com.urbanairship.api.push.model.audience.Selector;
import com.urbanairship.api.push.model.audience.location.SegmentDefinition;
import java.io.IOException;
public class SegmentDefinitionReader implements JsonObjectReader {
private final SegmentDefinition.Builder builder;
public SegmentDefinitionReader() {
this.builder = SegmentDefinition.newBuilder();
}
public void readDisplayName(JsonParser parser) throws IOException {
builder.setDisplayName(StringFieldDeserializer.INSTANCE.deserialize(parser, "display_name"));
}
public void readCriteria(JsonParser parser) throws IOException {
builder.setCriteria(parser.readValueAs(Selector.class));
}
@Override
public SegmentDefinition validateAndBuild() throws IOException {
return builder.build();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy