de.lancom.openapi.entity.SecurityRequirement.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
/*****************************************************************************
** C A U T I O N **
** This file is auto-generated! **
** If you want to make changes, please see the README.md file. **
** Please do not edit this file directly! **
*****************************************************************************/
package de.lancom.openapi.entity
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.annotation.JsonSerialize
import de.lancom.openapi.field.Field
import de.lancom.openapi.jackson.EntityDeserializer
import de.lancom.openapi.jackson.EntitySerializer
import de.lancom.openapi.jackson.Parser
import de.lancom.openapi.jackson.Wrapper
import de.lancom.openapi.tools.toYamlString
// hint:9A1BF04C
@Suppress("PropertyName")
@JsonSerialize(using = SecurityRequirement.Companion.Serializer::class)
@JsonDeserialize(using = SecurityRequirement.Companion.Deserializer::class)
data class SecurityRequirement(
val _jsonNode: Field = Field.unset(),
) : Entity {
///////////////////////
//
// jsonNode
//
///////////////////////
// hint:3A7F9B2E
val jsonNode: JsonNode
get() = _jsonNode.getOrError()
// hint:F0C48D71
fun setJsonNodeField(jsonNode: Field): SecurityRequirement {
return copy(_jsonNode = jsonNode)
}
// hint:8E56A4D9
fun updateJsonNodeField(updater: (Field) -> Field): SecurityRequirement {
return setJsonNodeField(updater(_jsonNode))
}
// hint:B1D730FC
fun updateJsonNode(updater: (JsonNode) -> JsonNode): SecurityRequirement {
return updateJsonNodeField { field ->
field.flatMap { value ->
Field(updater(value))
}
}
}
// hint:6542E98A
fun mergeJsonNodeField(jsonNodeFieldToMerge: Field): SecurityRequirement {
return mergeJsonNode(jsonNodeFieldToMerge.orNull)
}
// hint:A8BC6F23
fun mergeJsonNode(jsonNodeToMerge: JsonNode?): SecurityRequirement {
return if (jsonNodeToMerge == null) {
this
} else {
val oldJsonNode = _jsonNode.orNull
if (oldJsonNode == null) {
setJsonNodeField(Field(jsonNodeToMerge))
} else {
// hint:2F684DAC
setJsonNode(jsonNodeToMerge)
}
}
}
// hint:87B3E19C
fun setJsonNode(jsonNode: JsonNode): SecurityRequirement {
return setJsonNodeField(Field(jsonNode))
}
// hint:D465F782
fun unsetJsonNode(): SecurityRequirement {
return setJsonNodeField(Field.unset())
}
// hint:47C9A0F6
fun addJsonNode(jsonNode: JsonNode): SecurityRequirement {
return setJsonNode(jsonNode)
}
// hint:6A81E3FD
override val entityDescriptor: EntityDescriptor by lazy {
EntityDescriptor(
entity = this,
jsonNode = _jsonNode,
map = mapOf(
),
flatMap = listOf(
),
flatten = listOf(
),
)
}
override fun toString(): String {
return this.toYamlString()
}
// hint:A0E5F382
override fun mergeEntity(other: Entity?): SecurityRequirement {
return when (other) {
null ->
this
is SecurityRequirement ->
merge(other)
else ->
TODO()
}
}
// hint:716BFD54
fun merge(other: SecurityRequirement?): SecurityRequirement {
if (other == null) return this
return this
.mergeJsonNodeField(other._jsonNode)
}
companion object : JsonEntityFactory {
class Serializer : EntitySerializer(SecurityRequirement::class.java, SecurityRequirement)
class Deserializer : EntityDeserializer(SecurityRequirement::class.java, SecurityRequirement)
// hint:5F72B6D8
override fun parseWrapper(wrapper: Wrapper): SecurityRequirement {
return SecurityRequirement(
_jsonNode = wrapper.jsonNodeFieldOrUnsetIfEmpty,
)
}
}
}