Class ImporterUtils
java.lang.Object
com.atlassian.bamboo.specs.api.validators.common.ImporterUtils
Utility validation methods for importing Bamboo Specs.
Methods from this class prefixed with check
throw exceptions on failures. For validation utility
methods which return validation problems instead of throwing, use ValidationUtils
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkArgument
(@NotNull ValidationContext validationContext, boolean expression, Object errorMessage) static void
checkNoErrors
(@NotNull List<ValidationProblem> errors) static void
checkNoErrors
(@NotNull Optional<ValidationProblem> error) static String
checkNotBlank
(@NotNull ValidationContext validationContext, @NotNull String argumentName, @Nullable String o) Used to extra validate argument that shouldn't be blank.static String
checkNotBlank
(@NotNull String argumentName, @Nullable String o) Used to extra validate argument that shouldn't be blank.static String
checkNotEmpty
(@NotNull ValidationContext validationContext, @NotNull String argumentName, @Nullable String s) static String
checkNotEmpty
(@NotNull String argumentName, @Nullable String s) static void
checkNotNegative
(@NotNull ValidationContext validationContext, @NotNull String argumentName, int value) Used during building properties to check that a number is a non-negative integer.static void
checkNotNegative
(@NotNull String argumentName, int value) Used during building properties to check that a number is a non-negative integer.static <T> T
checkNotNull
(@NotNull ValidationContext validationContext, @NotNull String argumentName, T o) Used to extra validate argument that shouldn't be null to throw our exception instead of NPE.static <T> T
checkNotNull
(@NotNull String argumentName, T o) Used to extra validate argument that shouldn't be null to throw our exception instead of NPE.static void
checkPluginKey
(@NotNull ValidationContext validationContext, @NotNull AtlassianModuleProperties actual, @NotNull AtlassianModuleProperties expected) static void
checkPositive
(@NotNull ValidationContext validationContext, @NotNull String argumentName, int value) Used during building properties to check that a number is a positive integer.static void
checkPositive
(@NotNull ValidationContext validationContext, @NotNull String argumentName, long value) Used during building properties to check that a number is a positive integer.static void
checkPositive
(@NotNull String argumentName, int value) Used during building properties to check that a number is a positive integer.static void
checkPositive
(@NotNull String argumentName, long value) Used during building properties to check that a number is a positive integer.static void
checkRequired
(@NotNull ValidationContext validationContext, @NotNull String propertyName, @Nullable Object o) Used during building properties object when some property is missing.static void
checkRequired
(@NotNull ValidationContext validationContext, @Nullable Object o) Used during building properties object when some property is missing.static void
checkRequiredNotBlank
(@NotNull ValidationContext validationContext, @Nullable String s) Used during building properties object when some property is missing.static void
checkThat
(@NotNull ValidationContext validationContext, boolean condition, @NotNull String messageFormat, @NotNull Object... messageArgs) static void
-
Method Details
-
checkPluginKey
public static void checkPluginKey(@NotNull @NotNull ValidationContext validationContext, @NotNull @NotNull AtlassianModuleProperties actual, @NotNull @NotNull AtlassianModuleProperties expected) throws PropertiesValidationException - Throws:
PropertiesValidationException
-
checkThat
public static void checkThat(@NotNull @NotNull ValidationContext validationContext, boolean condition, @NotNull @NotNull String messageFormat, @NotNull @NotNull Object... messageArgs) throws PropertiesValidationException - Throws:
PropertiesValidationException
-
checkThat
public static void checkThat(@NotNull @NotNull String message, @NotNull @org.jetbrains.annotations.NotNull boolean condition) throws PropertiesValidationException - Throws:
PropertiesValidationException
-
checkNoErrors
public static void checkNoErrors(@NotNull @NotNull List<ValidationProblem> errors) throws PropertiesValidationException - Throws:
PropertiesValidationException
-
checkNoErrors
public static void checkNoErrors(@NotNull @NotNull Optional<ValidationProblem> error) throws PropertiesValidationException - Throws:
PropertiesValidationException
-
checkRequired
public static void checkRequired(@NotNull @NotNull ValidationContext validationContext, @Nullable @Nullable Object o) throws PropertiesValidationException Used during building properties object when some property is missing.- Throws:
PropertiesValidationException
-
checkRequired
public static void checkRequired(@NotNull @NotNull ValidationContext validationContext, @NotNull @NotNull String propertyName, @Nullable @Nullable Object o) throws PropertiesValidationException Used during building properties object when some property is missing.- Throws:
PropertiesValidationException
-
checkRequiredNotBlank
public static void checkRequiredNotBlank(@NotNull @NotNull ValidationContext validationContext, @Nullable @Nullable String s) throws PropertiesValidationException Used during building properties object when some property is missing.- Throws:
PropertiesValidationException
-
checkNotNull
public static <T> T checkNotNull(@NotNull @NotNull String argumentName, @Nullable T o) throws PropertiesValidationException Used to extra validate argument that shouldn't be null to throw our exception instead of NPE.- Throws:
PropertiesValidationException
-
checkNotNull
public static <T> T checkNotNull(@NotNull @NotNull ValidationContext validationContext, @NotNull @NotNull String argumentName, @Nullable T o) throws PropertiesValidationException Used to extra validate argument that shouldn't be null to throw our exception instead of NPE.- Throws:
PropertiesValidationException
-
checkNotEmpty
public static String checkNotEmpty(@NotNull @NotNull String argumentName, @Nullable @Nullable String s) throws PropertiesValidationException - Throws:
PropertiesValidationException
-
checkNotEmpty
public static String checkNotEmpty(@NotNull @NotNull ValidationContext validationContext, @NotNull @NotNull String argumentName, @Nullable @Nullable String s) throws PropertiesValidationException - Throws:
PropertiesValidationException
-
checkArgument
public static void checkArgument(@NotNull @NotNull ValidationContext validationContext, boolean expression, Object errorMessage) -
checkNotBlank
public static String checkNotBlank(@NotNull @NotNull String argumentName, @Nullable @Nullable String o) throws PropertiesValidationException Used to extra validate argument that shouldn't be blank.- Throws:
PropertiesValidationException
-
checkNotBlank
public static String checkNotBlank(@NotNull @NotNull ValidationContext validationContext, @NotNull @NotNull String argumentName, @Nullable @Nullable String o) throws PropertiesValidationException Used to extra validate argument that shouldn't be blank.- Throws:
PropertiesValidationException
-
checkNotNegative
public static void checkNotNegative(@NotNull @NotNull String argumentName, int value) throws PropertiesValidationException Used during building properties to check that a number is a non-negative integer.- Throws:
PropertiesValidationException
-
checkNotNegative
public static void checkNotNegative(@NotNull @NotNull ValidationContext validationContext, @NotNull @NotNull String argumentName, int value) throws PropertiesValidationException Used during building properties to check that a number is a non-negative integer.- Throws:
PropertiesValidationException
-
checkPositive
public static void checkPositive(@NotNull @NotNull String argumentName, int value) throws PropertiesValidationException Used during building properties to check that a number is a positive integer.- Throws:
PropertiesValidationException
-
checkPositive
public static void checkPositive(@NotNull @NotNull String argumentName, long value) throws PropertiesValidationException Used during building properties to check that a number is a positive integer.- Throws:
PropertiesValidationException
-
checkPositive
public static void checkPositive(@NotNull @NotNull ValidationContext validationContext, @NotNull @NotNull String argumentName, int value) throws PropertiesValidationException Used during building properties to check that a number is a positive integer.- Throws:
PropertiesValidationException
-
checkPositive
public static void checkPositive(@NotNull @NotNull ValidationContext validationContext, @NotNull @NotNull String argumentName, long value) throws PropertiesValidationException Used during building properties to check that a number is a positive integer.- Throws:
PropertiesValidationException
-