Package com.amihaiemil.eoyaml
Interface YamlMapping
-
- All Superinterfaces:
Comparable<YamlNode>,YamlNode
- All Known Implementing Classes:
BaseYamlMapping,EmptyYamlMapping,MergedYamlMapping,StrictYamlMapping
public interface YamlMapping extends YamlNode
A Yaml mapping.- Since:
- 1.0.0
- Version:
- $Id: 64c8f3c72feccf3b9dfbe994bb8d814466f6cd42 $
- Author:
- Mihai Andronache (amihaiemil@gmail.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default LocalDatedate(YamlNode key)Convenience method to directly read a LocalDate value from this map.default LocalDatedate(String key)Convenience method to directly read a LocalDate value from this map.default LocalDateTimedateTime(YamlNode key)Convenience method to directly read a LocalDateTime value from this map.default LocalDateTimedateTime(String key)Convenience method to directly read a LocalDateTime value from this map.default doubledoubleNumber(YamlNode key)Convenience method to directly read a double value from this map.default doubledoubleNumber(String key)Convenience method to directly read a double value from this map.default floatfloatNumber(YamlNode key)Convenience method to directly read a float value from this map.default floatfloatNumber(String key)Convenience method to directly read a float value from this map.default StringfoldedBlockScalar(YamlNode key)Get the String folded block scalar associated with the given key.default StringfoldedBlockScalar(String key)Get the String folded block scalar associated with the given key.default intinteger(YamlNode key)Convenience method to directly read an integer value from this map.default intinteger(String key)Convenience method to directly read an integer value from this map.Set<YamlNode>keys()Return the keys' set of this mapping.default Collection<String>literalBlockScalar(YamlNode key)Get the String lines of the literal block scalar associated with the given key.default Collection<String>literalBlockScalar(String key)Get the String lines of the literal block scalar associated with the given key.default longlongNumber(YamlNode key)Convenience method to directly read a long value from this map.default longlongNumber(String key)Convenience method to directly read a long value from this map.default Stringstring(YamlNode key)Get the String associated with the given key.default Stringstring(String key)Get the String associated with the given key.YamlNodevalue(YamlNode key)Get the YamlNode mapped to the specified key.default YamlNodevalue(String key)Get the YamlNode mapped to the specified key.default Collection<YamlNode>values()Fetch the values of this mapping.default YamlMappingyamlMapping(YamlNode key)Get the Yaml mapping associated with the given key.default YamlMappingyamlMapping(String key)Get the Yaml mapping associated with the given key.default YamlSequenceyamlSequence(YamlNode key)Get the Yaml sequence associated with the given key.default YamlSequenceyamlSequence(String key)Get the Yaml sequence associated with the given key.-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
value
YamlNode value(YamlNode key)
Get the YamlNode mapped to the specified key.- Parameters:
key- YamlNode key. Could be a simple scalar, a YamlMapping or a YamlSequence.- Returns:
- The found YamlNode or null if nothing is found.
-
values
default Collection<YamlNode> values()
Fetch the values of this mapping.- Returns:
- Collection of
YamlNode
-
yamlMapping
default YamlMapping yamlMapping(String key)
Get the Yaml mapping associated with the given key.- Parameters:
key- String key- Returns:
- Yaml mapping or null if the key is missing, or not pointing to a mapping.
-
yamlMapping
default YamlMapping yamlMapping(YamlNode key)
Get the Yaml mapping associated with the given key.- Parameters:
key- Yaml node (mapping or sequence) key- Returns:
- Yaml mapping or null if the key is missing, or not pointing to a mapping.
-
yamlSequence
default YamlSequence yamlSequence(String key)
Get the Yaml sequence associated with the given key.- Parameters:
key- String key- Returns:
- Yaml sequence or null if the key is missing, or not pointing to a sequence.
-
yamlSequence
default YamlSequence yamlSequence(YamlNode key)
Get the Yaml sequence associated with the given key.- Parameters:
key- Yaml node (mapping or sequence) key- Returns:
- Yaml sequence or null if the key is missing, or not pointing to a sequence
-
string
default String string(String key)
Get the String associated with the given key.- Parameters:
key- String key- Returns:
- String or null if the key is missing, or not pointing to a scalar.
-
string
default String string(YamlNode key)
Get the String associated with the given key.- Parameters:
key- Yaml node key- Returns:
- String or null if the key is missing, or not pointing to a scalar.
-
foldedBlockScalar
default String foldedBlockScalar(String key)
Get the String folded block scalar associated with the given key.- Parameters:
key- String key- Returns:
- String or null if the key is missing, or not pointing to a folded block scalar.
-
foldedBlockScalar
default String foldedBlockScalar(YamlNode key)
Get the String folded block scalar associated with the given key.- Parameters:
key- Yaml node key.- Returns:
- String or null if the key is missing, or not pointing to a folded block scalar.
-
literalBlockScalar
default Collection<String> literalBlockScalar(String key)
Get the String lines of the literal block scalar associated with the given key.- Parameters:
key- String key- Returns:
- Collection of String or null if the key is missing, or not pointing to a literal block scalar.
-
literalBlockScalar
default Collection<String> literalBlockScalar(YamlNode key)
Get the String lines of the literal block scalar associated with the given key.- Parameters:
key- String key- Returns:
- Collection of String or null if the key is missing, or not pointing to a literal block scalar.
-
value
default YamlNode value(String key)
Get the YamlNode mapped to the specified key.- Parameters:
key- String key.- Returns:
- The found YamlNode or null if nothing is found.
-
integer
default int integer(String key)
Convenience method to directly read an integer value from this map. It is equivalent to:YamlMapping map = ...; int value = Integer.parseInt(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found integer or -1 if there is no value for the key, or the value is not a Scalar.
- Throws:
NumberFormatException- - if the Scalar value is not a parsable integer.
-
integer
default int integer(YamlNode key)
Convenience method to directly read an integer value from this map. It is equivalent to:YamlMapping map = ...; int value = Integer.parseInt(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found integer or -1 if there is no value for the key, or the value is not a Scalar.
- Throws:
NumberFormatException- - if the Scalar value is not a parsable integer.
-
floatNumber
default float floatNumber(String key)
Convenience method to directly read a float value from this map. It is equivalent to:YamlMapping map = ...; float value = Float.parseFloat(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found float or -1 if there is no value for the key, or the value is not a Scalar.
- Throws:
NumberFormatException- - if the Scalar value is not a parsable float.
-
floatNumber
default float floatNumber(YamlNode key)
Convenience method to directly read a float value from this map. It is equivalent to:YamlMapping map = ...; float value = Float.parseFloat(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found float or -1 if there is no value for the key, or the value is not a Scalar.
- Throws:
NumberFormatException- - if the Scalar value is not a parsable float.
-
doubleNumber
default double doubleNumber(String key)
Convenience method to directly read a double value from this map. It is equivalent to:YamlMapping map = ...; double value = Double.parseDouble(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found double or -1.0 if there is no value for the key, or the value is not a Scalar.
- Throws:
NumberFormatException- - if the Scalar value is not a parsable double.
-
doubleNumber
default double doubleNumber(YamlNode key)
Convenience method to directly read a double value from this map. It is equivalent to:YamlMapping map = ...; double value = Double.parseDouble(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found double or -1.0 if there is no value for the key, or the value is not a Scalar.
- Throws:
NumberFormatException- - if the Scalar value is not a parsable double.
-
longNumber
default long longNumber(String key)
Convenience method to directly read a long value from this map. It is equivalent to:YamlMapping map = ...; long value = Long.parseLong(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found long or -1L if there is no value for the key, or the value is not a Scalar.
- Throws:
NumberFormatException- - if the Scalar value is not a parsable long.
-
longNumber
default long longNumber(YamlNode key)
Convenience method to directly read a long value from this map. It is equivalent to:YamlMapping map = ...; long value = Long.parseLong(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found long or -1L if there is no value for the key, or the value is not a Scalar.
- Throws:
NumberFormatException- - if the Scalar value is not a parsable long.
-
date
default LocalDate date(String key)
Convenience method to directly read a LocalDate value from this map. It is equivalent to:YamlMapping map = ...; LocalDate date = LocalDate.parse(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found LocalDate or null if there is no value for the key, or the value is not a Scalar.
- Throws:
DateTimeParseException- - if the Scalar value cannot be parsed.
-
date
default LocalDate date(YamlNode key)
Convenience method to directly read a LocalDate value from this map. It is equivalent to:YamlMapping map = ...; LocalDate date = LocalDate.parse(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found LocalDate or null if there is no value for the key, or the value is not a Scalar.
- Throws:
DateTimeParseException- - if the Scalar value cannot be parsed.
-
dateTime
default LocalDateTime dateTime(String key)
Convenience method to directly read a LocalDateTime value from this map. It is equivalent to:YamlMapping map = ...; LocalDateTime dateTime = LocalDateTime.parse(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found LocalDateTime or null if there is no value for the key, or the value is not a Scalar.
- Throws:
DateTimeParseException- - if the Scalar value cannot be parsed.
-
dateTime
default LocalDateTime dateTime(YamlNode key)
Convenience method to directly read a LocalDateTime value from this map. It is equivalent to:YamlMapping map = ...; LocalDateTime dateTime = LocalDateTime.parse(map.string(...));- Parameters:
key- The key of the value.- Returns:
- Found LocalDateTime or null if there is no value for the key, or the value is not a Scalar.
- Throws:
DateTimeParseException- - if the Scalar value cannot be parsed.
-
-