YamlNode

shampoo.yaml.YamlNode
sealed trait YamlNode

Defines YAML node.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait YamlMapping
trait YamlSequence
trait YamlScalar
trait YamlBoolean
object YamlNull.type
trait YamlNumber
trait YamlString
Show all

Members list

Value members

Concrete methods

def \(key: String): YamlNode
Extension method from shampoo.yaml

Gets value in YAML mapping.

Gets value in YAML mapping.

Value parameters

key

mapping key

Attributes

Throws
ClassCastException

if not YamlMapping

def \(index: Int): YamlNode
Extension method from shampoo.yaml

Gets value in YAML sequence.

Gets value in YAML sequence.

Value parameters

index

sequence index

Attributes

Throws
ClassCastException

if not YamlSequence

def \\(key: String): Seq[YamlNode]
Extension method from shampoo.yaml

Collects values with given key in traversed collections.

Collects values with given key in traversed collections.

import shampoo.yaml.{ Yaml, \\, given }

val yaml = Yaml.load("""
 node:
   name: localhost
   users:
     - id: 0
       name: root
     - id: 1000
       name: lupita
""")

val names = (yaml \\ "name").map(_.as[String])

assert { names == Seq("localhost", "root", "lupita") }

Value parameters

key

mappings key

Attributes

def apply(key: String): YamlNode
Implicitly added by yamlStructureFacadeConversion

Gets node.

Gets node.

Value parameters

key

mapping key

Attributes

Throws
java.util.NoSuchElementException

if key or value does not exist

def apply(index: Int): YamlNode
Implicitly added by yamlStructureFacadeConversion

Gets node.

Gets node.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

def as[T](using constructor: YamlConstructor[T]): T

Constructs data.

Constructs data.

Value parameters

constructor

data constructor

Attributes

def contains(key: String): Boolean
Implicitly added by yamlStructureFacadeConversion

Tests for key.

Tests for key.

Value parameters

key

mapping key

Attributes

def keys: Set[String]
Implicitly added by yamlStructureFacadeConversion

Gets keys.

Gets keys.

Attributes

def size: Int
Implicitly added by yamlStructureFacadeConversion

Gets collection size.

Gets collection size.

Attributes

def toMap: Map[String, YamlNode]
Implicitly added by yamlStructureFacadeConversion

Gets key-node map.

Gets key-node map.

Attributes

def toSeq: Seq[YamlNode]
Implicitly added by yamlStructureFacadeConversion

Gets node sequence.

Gets node sequence.

Attributes

Inherited methods

def as[T](using constructor: YamlConstructor[T]): T
Implicitly added by yamlStructureFacadeConversion

Constructs data.

Constructs data.

Value parameters

constructor

data constructor

Attributes

Inherited from:
YamlNode
def get(key: String): Option[YamlNode]
Implicitly added by yamlStructureFacadeConversion

Optionally gets node.

Optionally gets node.

Value parameters

key

mapping key

Attributes

Inherited from:
YamlMapping
def getBigDecimal(index: Int): BigDecimal
Implicitly added by yamlStructureFacadeConversion

Gets node as BigDecimal.

Gets node as BigDecimal.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getBigDecimal(key: String): BigDecimal
Implicitly added by yamlStructureFacadeConversion

Gets node as BigDecimal.

Gets node as BigDecimal.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getBigInt(index: Int): BigInt
Implicitly added by yamlStructureFacadeConversion

Gets node as BigInt.

Gets node as BigInt.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getBigInt(key: String): BigInt
Implicitly added by yamlStructureFacadeConversion

Gets node as BigInt.

Gets node as BigInt.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getBoolean(index: Int): Boolean
Implicitly added by yamlStructureFacadeConversion

Gets node as Boolean.

Gets node as Boolean.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getBoolean(key: String): Boolean
Implicitly added by yamlStructureFacadeConversion

Gets node as Boolean.

Gets node as Boolean.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getDouble(index: Int): Double
Implicitly added by yamlStructureFacadeConversion

Gets node as Double.

Gets node as Double.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getDouble(key: String): Double
Implicitly added by yamlStructureFacadeConversion

Gets node as Double.

Gets node as Double.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getFloat(index: Int): Float
Implicitly added by yamlStructureFacadeConversion

Gets node as Float.

Gets node as Float.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getFloat(key: String): Float
Implicitly added by yamlStructureFacadeConversion

Gets node as Float.

Gets node as Float.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getInt(index: Int): Int
Implicitly added by yamlStructureFacadeConversion

Gets node as Int.

Gets node as Int.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getInt(key: String): Int
Implicitly added by yamlStructureFacadeConversion

Gets node as Int.

Gets node as Int.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getLong(index: Int): Long
Implicitly added by yamlStructureFacadeConversion

Gets node as Long.

Gets node as Long.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getLong(key: String): Long
Implicitly added by yamlStructureFacadeConversion

Gets node as Long.

Gets node as Long.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getMapping(index: Int): YamlMapping
Implicitly added by yamlStructureFacadeConversion

Gets node as YamlMapping.

Gets node as YamlMapping.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getMapping(key: String): YamlMapping
Implicitly added by yamlStructureFacadeConversion

Gets node as YamlMapping.

Gets node as YamlMapping.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getOrElse(key: String, default: => YamlNode): YamlNode
Implicitly added by yamlStructureFacadeConversion

Gets node or returns default node.

Gets node or returns default node.

Value parameters

default

default node

key

mapping key

Attributes

Inherited from:
YamlMapping
def getSequence(index: Int): YamlSequence
Implicitly added by yamlStructureFacadeConversion

Gets node as YamlSequence.

Gets node as YamlSequence.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getSequence(key: String): YamlSequence
Implicitly added by yamlStructureFacadeConversion

Gets node as YamlSequence.

Gets node as YamlSequence.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def getString(index: Int): String
Implicitly added by yamlStructureFacadeConversion

Gets node as String.

Gets node as String.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def getString(key: String): String
Implicitly added by yamlStructureFacadeConversion

Gets node as String.

Gets node as String.

Value parameters

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def isEmpty: Boolean
Implicitly added by yamlStructureFacadeConversion

Tests for empty.

Tests for empty.

Attributes

Inherited from:
YamlCollection
def isNull(index: Int): Boolean
Implicitly added by yamlStructureFacadeConversion

Tests for null.

Tests for null.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

Inherited from:
YamlSequence
def isNull(key: String): Boolean
Implicitly added by yamlStructureFacadeConversion

Tests for null.

Tests for null.

Value parameters

key

mapping key

Attributes

Throws
java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def nonEmpty: Boolean
Implicitly added by yamlStructureFacadeConversion

Tests for non-empty.

Tests for non-empty.

Attributes

Inherited from:
YamlCollection
def read[T](index: Int)(using constructor: YamlConstructor[T]): T
Implicitly added by yamlStructureFacadeConversion

Reads constructed data.

Reads constructed data.

Value parameters

index

sequence index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if node is null

Inherited from:
YamlSequence
def read[T](key: String)(using constructor: YamlConstructor[T]): T
Implicitly added by yamlStructureFacadeConversion

Reads constructed data.

Reads constructed data.

Value parameters

constructor

data constructor

key

mapping key

Attributes

Throws
java.lang.NullPointerException

if node is null

java.util.NoSuchElementException

if key does not exist

Inherited from:
YamlMapping
def readOption[T](index: Int)(using constructor: YamlConstructor[T]): Option[T]
Implicitly added by yamlStructureFacadeConversion

Optionally reads constructed data.

Optionally reads constructed data.

Value parameters

constructor

data constructor

index

sequence index

Attributes

Returns

Some constructed data, or None if node is null

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

Inherited from:
YamlSequence
def readOption[T](key: String)(using constructor: YamlConstructor[T]): Option[T]
Implicitly added by yamlStructureFacadeConversion

Optionally reads constructed data.

Optionally reads constructed data.

Value parameters

constructor

data constructor

key

mapping key

Attributes

Returns

Some constructed data, or None if key does not exists or its associated node is null

Inherited from:
YamlMapping
def readOrElse[T](index: Int, default: => T)(using constructor: YamlConstructor[T]): T
Implicitly added by yamlStructureFacadeConversion

Reads constructed data or returns default value.

Reads constructed data or returns default value.

Value parameters

constructor

data constructor

index

sequence index

Attributes

Returns

constructed data, or default value if node is null

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

Inherited from:
YamlSequence
def readOrElse[T](key: String, default: => T)(using constructor: YamlConstructor[T]): T
Implicitly added by yamlStructureFacadeConversion

Reads constructed data or returns default value.

Reads constructed data or returns default value.

Value parameters

constructor

data constructor

key

mapping key

Attributes

Returns

constructed data, or default value if key does not exist or its associated node is null

Inherited from:
YamlMapping