com.sinch.sdk.domains.numbers.api.v1.adapters.ScheduledVoiceProvisioningMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sinch-sdk-java Show documentation
Show all versions of sinch-sdk-java Show documentation
SDK providing a Java API for the Sinch REST APIs.
package com.sinch.sdk.domains.numbers.api.v1.adapters;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.sinch.sdk.core.utils.databind.Mapper;
import com.sinch.sdk.domains.numbers.models.v1.ScheduledVoiceProvisioning;
import com.sinch.sdk.domains.numbers.models.v1.internal.ScheduledVoiceProvisioningInternalImpl;
import java.io.IOException;
import java.util.logging.Logger;
public class ScheduledVoiceProvisioningMapper {
private static final Logger LOGGER =
Logger.getLogger(ScheduledVoiceProvisioningMapper.class.getName());
public static void initMapper() {
SimpleModule module =
new SimpleModule()
.addDeserializer(
ScheduledVoiceProvisioning.class, new ScheduledVoiceProvisioningDeserializer());
Mapper.getInstance().registerModule(module);
}
private static final class ScheduledVoiceProvisioningDeserializer
extends StdDeserializer {
private static final long serialVersionUID = 1L;
public ScheduledVoiceProvisioningDeserializer() {
this(ScheduledVoiceProvisioning.class);
}
public ScheduledVoiceProvisioningDeserializer(Class> vc) {
super(vc);
}
@Override
public ScheduledVoiceProvisioning deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException {
ScheduledVoiceProvisioningInternalImpl internal =
Mapper.getInstance().readValue(jp, ScheduledVoiceProvisioningInternalImpl.class);
return (ScheduledVoiceProvisioning) internal.getActualInstance();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy