public class StringValidations extends Object
| Modifier and Type | Method and Description |
|---|---|
static Validation<String> |
contains(String contained)
creates a validation which validates if a string contains an expected text.
|
static Validation<String> |
contains(java.util.function.Supplier<String> contained)
creates a validation which validates if a string contains an expected text.
|
static Validation<String> |
containsNotOnly(String containedValue)
creates a validation which validates if a string contains not only an expected text.
|
static Validation<String> |
containsNotOnly(java.util.function.Supplier<String> containedValue)
creates a validation which validates if a string contains not only an expected text.
|
static Validation<String> |
hasLength(int length)
creates a validation which validates if a string length is equal to the provided size length argument.
|
static Validation<String> |
hasLength(java.util.function.Supplier<Integer> length)
creates a validation which validates if a string length is equal to the provided size length argument.
|
static Validation<String> |
isDate(java.time.format.DateTimeFormatter formatter)
creates a validation which validates that a string can be parsed to a date.
|
static Validation<String> |
isDate(java.util.function.Supplier<java.time.format.DateTimeFormatter> formatter)
creates a validation which validates that a string can be parsed to a date.
|
static Validation<String> |
isInArray(java.util.function.Supplier<String[]> validValueSupplier)
creates a validation which validates that a string is in a list of valid values.
|
static Validation<String> |
isInList(java.util.function.Supplier<Collection<String>> validValueSupplier)
creates a validation which validates that a string is in a list of valid values
|
static Validation<String> |
isNotBlank()
creates a validation which validates that a string is not blank(see StringUtils of apache commons)
|
static Validation<String> |
isNumeric()
creates a validation which validates if a string is numeric.
|
static Validation<String> |
lengthIsBetween(int minSize,
int maxSize)
creates a validation which validates if a string length is between the provided size arguments.
|
static Validation<String> |
lengthIsBetween(java.util.function.Supplier<Integer> minSize,
java.util.function.Supplier<Integer> maxSize)
creates a validation which validates if a string length is between the provided size arguments.
|
static Validation<String> |
lengthIsLessThan(int size)
creates a validation which validates that a string length is less than the provided size argument.
|
static Validation<String> |
lengthIsLessThan(java.util.function.Supplier<Integer> size)
creates a validation which validates that a string length is less than the provided size argument.
|
static Validation<String> |
lengthIsMoreThan(int size)
create a validation which validates that a string has a length more than the provided size argument.
|
static Validation<String> |
lengthIsMoreThan(java.util.function.Supplier<Integer> size)
create a validation which validates that a string has a length more than the provided size argument.
|
public static Validation<String> lengthIsMoreThan(int size)
size - string length is compared to that value and must be greaterpublic static Validation<String> lengthIsMoreThan(java.util.function.Supplier<Integer> size)
size - string length is compared to that value and must be greaterpublic static Validation<String> lengthIsLessThan(int size)
size - string length is compared to that value and must be lesspublic static Validation<String> lengthIsLessThan(java.util.function.Supplier<Integer> size)
size - string length is compared to that value and must be lesspublic static Validation<String> lengthIsBetween(int minSize, int maxSize)
minSize - the minimum size of the stringmaxSize - the maximum size of the stringpublic static Validation<String> lengthIsBetween(java.util.function.Supplier<Integer> minSize, java.util.function.Supplier<Integer> maxSize)
minSize - the minimum size of the stringmaxSize - the maximum size of the stringpublic static Validation<String> hasLength(int length)
length - the expected length of the stringpublic static Validation<String> hasLength(java.util.function.Supplier<Integer> length)
length - the expected length of the stringpublic static Validation<String> contains(String contained)
contained - the text which is expected somewhere in the stringpublic static Validation<String> contains(java.util.function.Supplier<String> contained)
contained - the text which is expected somewhere in the stringpublic static Validation<String> isNotBlank()
public static Validation<String> isInArray(java.util.function.Supplier<String[]> validValueSupplier)
validValueSupplier - supplier for the list of valid valuespublic static Validation<String> isInList(java.util.function.Supplier<Collection<String>> validValueSupplier)
validValueSupplier - supplier for the list of valid valuespublic static Validation<String> isDate(java.time.format.DateTimeFormatter formatter)
formatter - the formatter used to parse the datepublic static Validation<String> isDate(java.util.function.Supplier<java.time.format.DateTimeFormatter> formatter)
formatter - the formatter used to parse the datepublic static Validation<String> isNumeric()
public static Validation<String> containsNotOnly(String containedValue)
containedValue - is used to validate if the string contains only this textpublic static Validation<String> containsNotOnly(java.util.function.Supplier<String> containedValue)
containedValue - is used to validate if the string contains only this textCopyright © 2018. All rights reserved.