Element

class Element(val name: String, val type: String, val optional: Boolean = false, val nullable: Boolean = false, jsonNames: List<String> = emptyList(), val encodeDefault: EncodeDefaultMode? = null)

A single element (field) of a ContractKind.CLASS contract, recording the compatibility-bearing facts about how it appears on the JSON wire.

jsonNames is normalized to sorted order so that equality is independent of annotation declaration order.

Constructors

Link copied to clipboard
constructor(name: String, type: String, optional: Boolean = false, nullable: Boolean = false, jsonNames: List<String> = emptyList(), encodeDefault: EncodeDefaultMode? = null)

Properties

Link copied to clipboard

the field's @EncodeDefault mode (EncodeDefaultMode.ABSENT when verified to carry none), or null when it was not recorded and is therefore unknown (#158).

Link copied to clipboard

additional accepted input keys from @JsonNames.

Link copied to clipboard

the JSON key, post-@SerialName and post-namingStrategy.

Link copied to clipboard

whether the element accepts a JSON null.

Link copied to clipboard

whether the element may be omitted from the wire — straight from SerialDescriptor.isElementOptional, never re-derived.

Link copied to clipboard

the canonical type-reference string (a primitive/structural type such as List<String>, or the serial name of a referenced contract).

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String