YamlMappingBuilder

shampoo.yaml.YamlMappingBuilder

Defines YAML mapping builder.

import scala.language.implicitConversions

import shampoo.yaml.{ *, given }

val user = YamlMappingBuilder()
  .add("id", 1000)
  .add("name", "lupita")
  .add("groups", Set("lupita", "sudoer"))
  .toYamlMapping()

assert { user("id").as[Int] == 1000 }
assert { user("name").as[String] == "lupita" }
assert { user("groups").as[Set[String]] == Set("lupita", "sudoer") }

Attributes

See also
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def add(key: String, value: String): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def add(key: String, value: Boolean): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def add(key: String, value: Int): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def add(key: String, value: Long): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def add(key: String, value: Float): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def add(key: String, value: Double): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def add(key: String, value: BigInt): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def add(key: String, value: BigDecimal): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def add(key: String, value: YamlNode): YamlMappingBuilder.this.type

Adds key-value pair to mapping.

Adds key-value pair to mapping.

Attributes

Returns

this builder

def addNull(key: String): YamlMappingBuilder.this.type

Adds key associated with null value to mapping.

Adds key associated with null value to mapping.

Attributes

Returns

this builder

Constructs mapping.

Constructs mapping.

Attributes