YamlPrimitiveAdapter

class YamlPrimitiveAdapter(val backing: YamlPrimitive) : YamlElementAdapter, KpaPrimitive(source)

Adapter exposing a YamlPrimitive (including YamlNull) as a KpaPrimitive.

Primitive typing follows the YAML 1.2 core schema:

Parameters

backing

The underlying YamlPrimitive.

Constructors

Link copied to clipboard
constructor(backing: YamlPrimitive)

Properties

Link copied to clipboard
open override val backing: YamlPrimitive
Link copied to clipboard
open override val booleanOrNull: Boolean?

true/false parsed from the matching YAML 1.2 boolean literal; null if isBoolean is false.

Link copied to clipboard
open override val doubleOrNull: Double?

The literal content parsed as Double if isNumber; null otherwise.

Link copied to clipboard
open override val isBoolean: Boolean

true if backing is a YamlLiteral whose content matches a YAML 1.2 boolean literal.

Link copied to clipboard
open override val isNull: Boolean

true if backing is YamlNull.

Link copied to clipboard
open override val isNumber: Boolean

true if backing is a non-boolean YamlLiteral whose content parses as Long or Double.

Link copied to clipboard
open override val isString: Boolean

true if backing is a YamlLiteral whose content is not a YAML 1.2 boolean or number.

Link copied to clipboard
open override val longOrNull: Long?

The literal content parsed as Long if isNumber and the content has no fractional part; null otherwise.

Link copied to clipboard
open override val stringOrNull: String?

The literal content if isString; null otherwise.

Functions

Link copied to clipboard
open override fun renderedString(): String

Returns the literal content for YamlLiteral; "null" for YamlNull.

Link copied to clipboard
fun toYamlElement(): YamlElement

Returns the YamlPrimitive backing this adapter as a YamlElement.

Link copied to clipboard
fun KpaElement.toYamlElement(): YamlElement

Returns the YamlElement backing this adapter, or throws if this is not a YamlElementAdapter.