Constructor and Description |
---|
MapNode(@NotNull Map<String,?> structure,
@NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext) |
Modifier and Type | Method and Description |
---|---|
<T extends Node> |
getList(@NotNull String property,
@NotNull Class<T> expectedType)
Get a property from a parsed YAML as a
List of a particular type. |
@NotNull MapNode |
getMap(@NotNull String property)
Get a property from a parsed YAML as a
Map . |
@NotNull Node |
getNode(@NotNull String property)
Get a property from a parsed YAML as a generic
Node . |
@NotNull Optional<BooleanNode> |
getOptionalBoolean(@NotNull String property)
Get a property from a parsed YAML as a
Boolean , if the property is present. |
<T extends Node> |
getOptionalList(@NotNull String property,
@NotNull Class<T> expectedType)
Get a property from a parsed YAML as a
List of a particular type, if the property is present. |
@NotNull Optional<MapNode> |
getOptionalMap(@NotNull String property)
Get a property from a parsed YAML as a
Map if it's present. |
@NotNull Optional<Node> |
getOptionalNode(@NotNull String property)
Get a property from a parsed YAML as a generic
Node if it's present. |
@NotNull Optional<StringNode> |
getOptionalString(@NotNull String property)
Get a property from a parsed YAML as a
String , if the property is present. |
@NotNull Collection<String> |
getProperties() |
@NotNull StringNode |
getString(@NotNull String property)
Get a property from a parsed YAML as a
String . |
@NotNull List<String> |
getUnusedProperties()
Visits recursively the whole structure and returns list of unused properties.
|
getValidationContext, toString
@NotNull public @NotNull StringNode getString(@NotNull @NotNull String property)
String
. 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
or
Boolean
.
Note: blank strings are not accepted. This method will throw if the property is defined but is blank.
@NotNull public @NotNull Optional<StringNode> getOptionalString(@NotNull @NotNull String property)
String
, 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.
@NotNull public @NotNull Optional<BooleanNode> getOptionalBoolean(@NotNull @NotNull String property)
Boolean
, 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.
@NotNull public <T extends Node> @NotNull ListNode<T> getList(@NotNull @NotNull String property, @NotNull @NotNull Class<T> expectedType)
List
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.
@NotNull public <T extends Node> @NotNull Optional<ListNode<T>> getOptionalList(@NotNull @NotNull String property, @NotNull @NotNull Class<T> expectedType)
List
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.
@NotNull public @NotNull MapNode getMap(@NotNull @NotNull String property)
Map
. 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.
@NotNull public @NotNull Optional<MapNode> getOptionalMap(@NotNull @NotNull String property)
Map
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.
@NotNull public @NotNull Node getNode(@NotNull @NotNull String property)
Node
. Throws if property is not defined.@NotNull public @NotNull Optional<Node> getOptionalNode(@NotNull @NotNull String property)
Node
if it's present. Does not throw if the property
is not defined.@NotNull public @NotNull List<String> getUnusedProperties()
Node
@NotNull public @NotNull Collection<String> getProperties()
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.