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

de.lancom.openapi.field.FieldUnset.kt Maven / Gradle / Ivy

Go to download

This open-source project provides an OpenAPI 3.0 Parser implemented in Kotlin, utilizing immutable data classes

There is a newer version: 2.1.1
Show newest version
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()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy