de.lancom.openapi.field.FieldUnset.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-parser Show documentation
Show all versions of openapi-parser Show documentation
This open-source project provides an OpenAPI 3.0 Parser implemented in Kotlin, utilizing immutable data classes
package de.lancom.openapi.field
internal fun unsetField(): Field {
@Suppress("UNCHECKED_CAST")
return FieldUnset as Field
}
private object FieldUnset : Field {
override val optional: Field = this
override val isDefined: Boolean = false
override val orNull: Any? = null
override fun getOrError(): Any? {
TODO()
}
override fun getOrElse(default: () -> Any?): Any? {
return default()
}
override fun orDefault(default: () -> Any?): Field {
return Field(default())
}
override fun orElse(fallback: () -> Field): Field {
return fallback()
}
override fun map(mapper: (Any?) -> E): Field {
return Field.unset()
}
override fun flatMap(mapper: (Any?) -> Field): Field {
return Field.unset()
}
override fun mapField(mapper: (Field) -> E): Field {
return Field.unset()
}
}