public class ListValidations extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Validation<List<T>> |
contains(java.util.function.Supplier<T> containedValue)
validates that a list contains at least one entry which matches to the provided arg.
|
static <T> Validation<List<T>> |
contains(T containedValue)
validates that a list contains at least one entry which matches to the provided arg.
|
static <T> Validation<List<T>> |
containsOnly(java.util.function.Supplier<T> containedValue)
validates that a list contains only entries which match to the provided arg.
|
static <T> Validation<List<T>> |
containsOnly(T containedValue)
validates that a list contains only entries which match to the provided arg.
|
static <T> Validation<List<T>> |
doesNotContain(java.util.function.Supplier<T> excludedValue)
validates that a list does not contain an entry which matches the provided arg.
|
static <T> Validation<List<T>> |
doesNotContain(T excludedValue)
validates that a list does not contain an entry which matches the provided arg.
|
static <T> Validation<List<T>> |
forType(Class<T> listType,
Validation<List<T>> validation)
sadly this method is needed if you want to start with general validations on lists, like the notEmpty, and
afterwards the entries should be validated by a property.
|
static <T> Validation<List<T>> |
hasMaxSize(int size)
validates that a list has an expected maximum size.
|
static <T> Validation<List<T>> |
hasMaxSize(java.util.function.Supplier<Integer> size)
validates that a list has an expected maximum size.
|
static <T> Validation<List<T>> |
hasMinSize(int size)
validates that a list has an expected minimum size.
|
static <T> Validation<List<T>> |
hasMinSize(java.util.function.Supplier<Integer> size)
validates that a list has an expected minimum size.
|
static <T> Validation<List<T>> |
hasSize(int size)
validates that a list has an expected size.
|
static <T> Validation<List<T>> |
hasSize(java.util.function.Supplier<Integer> size)
validates that a list has an expected size.
|
static <T> Validation<List<T>> |
isEmpty()
validates that a list is empty.
|
static <T> Validation<List<T>> |
isNotEmpty()
validates that a list isn't empty.
|
static <T,E> Validation<List<T>> |
onProperty(java.util.function.Function<T,E> function,
Validation<List<E>> validation)
validation for a property of the list entries.
|
public static <T> Validation<List<T>> containsOnly(T containedValue)
T - the type of the listcontainedValue - the only value which is allowed in the listpublic static <T> Validation<List<T>> containsOnly(java.util.function.Supplier<T> containedValue)
T - the type of the listcontainedValue - the only value which is allowed in the listpublic static <T> Validation<List<T>> contains(T containedValue)
T - the type of the listcontainedValue - the value which must exist in the listpublic static <T> Validation<List<T>> contains(java.util.function.Supplier<T> containedValue)
T - the type of the listcontainedValue - the value which must exist in the listpublic static <T> Validation<List<T>> doesNotContain(T excludedValue)
T - the type of the listexcludedValue - the value which mustn't exists in the listpublic static <T> Validation<List<T>> doesNotContain(java.util.function.Supplier<T> excludedValue)
T - the type of the listexcludedValue - the value which mustn't exists in the listpublic static <T> Validation<List<T>> isNotEmpty()
T - the type of the listpublic static <T> Validation<List<T>> isEmpty()
T - the type of the listpublic static <T> Validation<List<T>> hasSize(int size)
T - type of the listsize - the expected sizepublic static <T> Validation<List<T>> hasSize(java.util.function.Supplier<Integer> size)
T - type of the listsize - the expected sizepublic static <T> Validation<List<T>> hasMinSize(int size)
T - type of the listsize - the expected minimum sizepublic static <T> Validation<List<T>> hasMinSize(java.util.function.Supplier<Integer> size)
T - type of the listsize - the expected minimum sizepublic static <T> Validation<List<T>> hasMaxSize(int size)
T - type of the listsize - the expected maximum sizepublic static <T> Validation<List<T>> hasMaxSize(java.util.function.Supplier<Integer> size)
T - type of the listsize - the expected maximum sizepublic static <T,E> Validation<List<T>> onProperty(java.util.function.Function<T,E> function, Validation<List<E>> validation)
T - type of the listE - type of the validated property of the list entryfunction - mapper for the property of the list entries(like in streams)validation - validation for the properties of the list. All validations for the property should be put herepublic static <T> Validation<List<T>> forType(Class<T> listType, Validation<List<T>> validation)
isNotEmpty(),
a Validation for List of type Object is returned, instead of the type of the list entries.T - the type of the validated listlistType - the generic typ of the list, which will be validatedvalidation - the validation which should be invoked for the validated list.Copyright © 2018. All rights reserved.