nl.vpro.domain.media.bind.AspectRatioToString Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of media-domain Show documentation
Show all versions of media-domain Show documentation
The basic domain classes for 'media', the core of POMS. Also, the 'update' XML bindings for it.
It also contains some closely related domain classes like the enum to contain NICAM kijkwijzer settings.
package nl.vpro.domain.media.bind;
import java.io.IOException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.*;
import nl.vpro.domain.media.AspectRatio;
/**
* @author Michiel Meeuwissen
* @since 2.0
*/
public class AspectRatioToString {
private AspectRatioToString() {
}
public static class Serializer extends JsonSerializer {
@Override
public void serialize(AspectRatio value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
jgen.writeString(value.toString());
}
}
public static class Deserializer extends JsonDeserializer {
@Override
public AspectRatio deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
return AspectRatio.fromString(jp.getText());
}
}
}