All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openprovenance.prov.scala.wrapper.CustomOptionPhraseSerializer.scala Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package org.openprovenance.prov.scala.wrapper

import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.jsontype.TypeSerializer
import com.fasterxml.jackson.databind.{JsonSerializer, SerializerProvider}
import defs.Phrase

class CustomOptionPhraseSerializer extends JsonSerializer[Option[Phrase]]{
  override def serialize(s: Option[Phrase], jsonGenerator: JsonGenerator, serializerProvider: SerializerProvider): Unit = {
    jsonGenerator.writeObject(s.getOrElse("<>"))
  }

  override def serializeWithType(s: Option[Phrase], jsonGenerator: JsonGenerator, serializers: SerializerProvider, typeSer: TypeSerializer): Unit = {
    jsonGenerator.writeObject(s.getOrElse("<>"))
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy