Commit 6d98c20e authored by Jonas Waeber's avatar Jonas Waeber

Add type adapters for all field types

parent d934954a
Pipeline #15821 passed with stage
in 4 minutes and 49 seconds
......@@ -18,7 +18,6 @@
package ch.memobase.mapping.fields
import ch.memobase.mapping.fields.ConfigField.AnnotationField.SimpleAnnotationField.MappedAnnotationField.DirectMapField
import com.beust.klaxon.TypeFor
import mapping.fields.FieldAdapter
import mapping.fields.FieldTypes
......@@ -28,7 +27,8 @@ import org.apache.jena.rdf.model.ResourceFactory
@TypeFor("fieldType", FieldAdapter::class)
sealed class ConfigField(val fieldType: String) {
sealed class AnnotationField(fieldType: String) : ConfigField(fieldType) {
@TypeFor("annotationFieldType", FieldAdapter::class)
sealed class AnnotationField(val annotationFieldType: String) : ConfigField(annotationFieldType) {
@TypeFor("simpleFieldType", FieldAdapter::class)
sealed class SimpleAnnotationField(val simpleFieldType: String) : AnnotationField(simpleFieldType) {
data class ConstantField(val key: String, val constant: String) : SimpleAnnotationField(FieldTypes.constant) {
......@@ -99,7 +99,8 @@ sealed class ConfigField(val fieldType: String) {
}
}
sealed class ComplexAnnotationField(fieldType: String) : AnnotationField(fieldType) {
@TypeFor("complexAnnotationFieldType", FieldAdapter::class)
sealed class ComplexAnnotationField(val complexAnnotationFieldType: String) : AnnotationField(complexAnnotationFieldType) {
data class ListField(val key: String, val fields: List<SimpleAnnotationField>) : ComplexAnnotationField(FieldTypes.list) {
fun toLiterals(source: Map<String, Any>): List<Literal> {
return fields.mapNotNull {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment