Class MapNode
- java.lang.Object
-
- com.atlassian.bamboo.specs.yaml.BaseNode
-
- com.atlassian.bamboo.specs.yaml.MapNode
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Node>
@NotNull ListNode<T>getList(@NotNull String property, @NotNull Class<T> expectedType)
Get a property from a parsed YAML as aList
of a particular type.@NotNull MapNode
getMap(@NotNull String property)
Get a property from a parsed YAML as aMap
.@NotNull Node
getNode(@NotNull String property)
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.<T extends Node>
@NotNull Optional<ListNode<T>>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.@NotNull Optional<MapNode>
getOptionalMap(@NotNull String property)
Get a property from a parsed YAML as aMap
if it's present.@NotNull Optional<Node>
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>
getProperties()
@NotNull StringNode
getString(@NotNull String property)
Get a property from a parsed YAML as aString
.@NotNull List<String>
getUnusedProperties()
Visits recursively the whole structure and returns list of unused properties.-
Methods inherited from class com.atlassian.bamboo.specs.yaml.BaseNode
getValidationContext, toString
-
-
-
-
Method Detail
-
getString
@NotNull public @NotNull StringNode getString(@NotNull @NotNull String property)
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
@NotNull public @NotNull Optional<StringNode> getOptionalString(@NotNull @NotNull String property)
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
@NotNull public @NotNull MapNode getMap(@NotNull @NotNull String property)
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
@NotNull public @NotNull Optional<MapNode> getOptionalMap(@NotNull @NotNull String property)
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
@NotNull public @NotNull Node getNode(@NotNull @NotNull String property)
Get a property from a parsed YAML as a genericNode
. Throws if property is not defined.
-
getOptionalNode
@NotNull public @NotNull Optional<Node> getOptionalNode(@NotNull @NotNull String property)
Get a property from a parsed YAML as a genericNode
if it's present. Does not throw if the property is not defined.
-
getUnusedProperties
@NotNull public @NotNull List<String> 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
@NotNull public @NotNull Collection<String> getProperties()
-
-