public class BambooYamlParserUtils extends Object
BambooYamlParser
,
BambooYamlDefinition
Modifier and Type | Field and Description |
---|---|
static String |
CFG_SERVER_NAME |
static String |
CFG_VERSION
Config constant to define YAML format version in each YAML document.
|
Modifier and Type | Method and Description |
---|---|
static Node |
asNode(Object obj,
com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext)
Transforms object generated by snakeyaml into a
Node structure. |
static <T> List<T> |
checkListNotEmpty(com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext,
List<T> list)
Checks that a list is not empty.
|
static <T extends Node> |
checkListType(List<? extends Node> list,
Class<T> expectedType)
Check that all elements of the given list are of expected type.
|
static Map<String,Object> |
checkMapType(com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext,
Map<?,?> value)
|
static <K,V> Map<K,V> |
checkMapType(com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext,
Map<?,?> value,
Class<K> expectedKeyType,
Class<V> expectedValueType)
Checks that all keys and values of a map are of expected types.
|
static <T> T |
checkPresent(com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext,
Optional<T> value)
Check that the given optional is present.
|
static <T> T |
checkRequired(com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext,
T value)
Check that the given value is not null.
|
static String |
checkStringNotBlank(com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext,
String value)
Checks that a string is not blank.
|
static <T extends Node> |
checkType(Node node,
Class<T> expectedType)
Check that the given node is of expected type.
|
static <T> T |
checkType(com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext,
Object value,
Class<T> expectedType)
Check that the given value is of expected type.
|
public static final String CFG_VERSION
public static final String CFG_SERVER_NAME
@NotNull public static Node asNode(@Nullable Object obj, @NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext)
Node
structure.
This method will cast the property to a string if it's a scalar (non-collection), e.g. Integer
or
Boolean
.
obj
- snakeyaml resultvalidationContext
- root validation contextNode
structure@Contract(value="_, null -> fail; _, !null -> !null") public static <T> T checkRequired(@NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext, @Nullable T value)
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
- on check failure@NotNull public static <T> T checkPresent(@NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext, @NotNull Optional<T> value)
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
- on check failure@NotNull public static <T> T checkType(@NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext, @Nullable Object value, @NotNull Class<T> expectedType)
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
- on check failure@NotNull public static <T extends Node> T checkType(@NotNull Node node, @NotNull Class<T> expectedType)
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
- on check failure@NotNull public static <T extends Node> List<T> checkListType(@NotNull List<? extends Node> list, @NotNull Class<T> expectedType)
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
- on check failure@NotNull public static Map<String,Object> checkMapType(@NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext, @NotNull Map<?,?> value)
@NotNull public static <K,V> Map<K,V> checkMapType(@NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext, @NotNull Map<?,?> value, @NotNull Class<K> expectedKeyType, @NotNull Class<V> expectedValueType)
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
- on check failure@NotNull public static String checkStringNotBlank(@NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext, @Nullable String value)
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
- on check failure@NotNull public static <T> List<T> checkListNotEmpty(@NotNull com.atlassian.bamboo.specs.api.validators.common.ValidationContext validationContext, @Nullable List<T> list)
com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
- on check failureCopyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.