jvmMain.it.unibo.tuprolog.serialize.JvmTermSerializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of serialize-core-jvm Show documentation
Show all versions of serialize-core-jvm Show documentation
JSON and YAML serialization support for logic terms and clauses
The newest version!
package it.unibo.tuprolog.serialize
import it.unibo.tuprolog.core.Term
import java.io.Writer
internal class JvmTermSerializer(override val mimeType: MimeType) : WritingTermSerializer {
private val mapper = mimeType.objectMapper
private val objectifier = JvmTermObjectifier()
override fun serialize(
writer: Writer,
value: Term,
) {
mapper.writeValue(writer, objectifier.objectify(value))
}
override fun serializeMany(
writer: Writer,
values: Iterable,
) {
mapper.writeValue(writer, objectifier.objectifyMany(values))
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy