Class MapNode
- All Implemented Interfaces:
Node
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet a property from a parsed YAML as aList
of a particular type.@NotNull MapNode
Get a property from a parsed YAML as aMap
.@NotNull Node
Get a property from a parsed YAML as a genericNode
.@NotNull Optional<BooleanNode>
getOptionalBoolean
(@NotNull String property) Get a property from a parsed YAML as aBoolean
, if the property is present.getOptionalList
(@NotNull String property, @NotNull Class<T> expectedType) Get a property from a parsed YAML as aList
of a particular type, if the property is present.getOptionalMap
(@NotNull String property) Get a property from a parsed YAML as aMap
if it's present.getOptionalNode
(@NotNull String property) Get a property from a parsed YAML as a genericNode
if it's present.@NotNull Optional<StringNode>
getOptionalString
(@NotNull String property) Get a property from a parsed YAML as aString
, if the property is present.@NotNull Collection<String>
@NotNull StringNode
Get a property from a parsed YAML as aString
.Visits recursively the whole structure and returns list of unused properties.Methods inherited from class com.atlassian.bamboo.specs.yaml.BaseNode
getValidationContext, toString
-
Constructor Details
-
MapNode
-
-
Method Details
-
getString
Get a property from a parsed YAML as aString
. Throws if the property is not defined or if it's of wrong type. This method will cast the property to a string if it's a scalar (non-collection), e.g.Integer
orBoolean
.Note: blank strings are not accepted. This method will throw if the property is defined but is blank.
-
getOptionalString
Get a property from a parsed YAML as aString
, if the property is present. Throws if the property is defined but is of wrong type.Note: blank strings are not accepted. This method will throw if the property is defined but is blank. If a property is optional, it should be skipped instead.
-
getOptionalBoolean
@NotNull public @NotNull Optional<BooleanNode> getOptionalBoolean(@NotNull @NotNull String property) Get a property from a parsed YAML as aBoolean
, if the property is present. Throws if the property is defined but is of wrong type.Note: Strings that are not boolean literals are not accepted.
-
getList
@NotNull public <T extends Node> @NotNull ListNode<T> getList(@NotNull @NotNull String property, @NotNull @NotNull Class<T> expectedType) Get a property from a parsed YAML as aList
of a particular type. Throws if the property is not defined, is of wrong type, or if any element from the list is of wrong type.Note: this method will throw if the list is empty! The intention is to use this method for lists which are required, and need to contain at least one element.
-
getOptionalList
@NotNull public <T extends Node> @NotNull Optional<ListNode<T>> getOptionalList(@NotNull @NotNull String property, @NotNull @NotNull Class<T> expectedType) Get a property from a parsed YAML as aList
of a particular type, if the property is present. Throws if the property is defined but is of wrong type, or if any element from the list is of wrong type.Note: this method will not throw if the list is empty. The intention is to use this method for lists which are optional. Skipped properties and properties defining empty lists should be treated as equal.
-
getMap
Get a property from a parsed YAML as aMap
. Throws if the property is not defined, is of wrong type, or if any key or value is of wrong type.Note: this method will not throw if the map is empty. It's not possible to tell which keys are meaningful and which are ignorable. Additional validation is necessary for the produced map.
-
getOptionalMap
Get a property from a parsed YAML as aMap
if it's present. Throws if the property is defined but is of wrong type, or if any key or value is of wrong type.Note: this method will not throw if the map is empty.
-
getNode
Get a property from a parsed YAML as a genericNode
. Throws if property is not defined. -
getOptionalNode
Get a property from a parsed YAML as a genericNode
if it's present. Does not throw if the property is not defined. -
getUnusedProperties
Description copied from interface:Node
Visits recursively the whole structure and returns list of unused properties. Children of unused properties are not reported. -
getProperties
-