public class ListValidationsWithErrorCode extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Validation<List<T>> |
contains(java.util.function.Supplier<T> containedValue,
String errorCode)
validates that a list contains at least one entry which matches to the provided arg.
|
static <T> Validation<List<T>> |
contains(T containedValue,
String errorCode)
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,
String errorCode)
validates that a list contains only entries which match to the provided arg.
|
static <T> Validation<List<T>> |
containsOnly(T containedValue,
String errorCode)
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,
String errorCode)
validates that a list does not contain an entry which matches the provided arg.
|
static <T> Validation<List<T>> |
doesNotContain(T excludedValue,
String errorCode)
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,
String errorCode)
validates that a list has an expected maximum size.
|
static <T> Validation<List<T>> |
hasMaxSize(java.util.function.Supplier<Integer> size,
String errorCode)
validates that a list has an expected maximum size.
|
static <T> Validation<List<T>> |
hasMinSize(int size,
String errorCode)
validates that a list has an expected minimum size.
|
static <T> Validation<List<T>> |
hasMinSize(java.util.function.Supplier<Integer> size,
String errorCode)
validates that a list has an expected minimum size.
|
static <T> Validation<List<T>> |
hasSize(int size,
String errorCode)
validates that a list has an expected size.
|
static <T> Validation<List<T>> |
hasSize(java.util.function.Supplier<Integer> size,
String errorCode)
validates that a list has an expected size.
|
static <T> Validation<List<T>> |
isEmpty(String errorCode)
validates that a list is empty.
|
static <T> Validation<List<T>> |
isNotEmpty(String errorCode)
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, String errorCode)
T - the type of the listcontainedValue - the only value which is allowed in the listerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> containsOnly(java.util.function.Supplier<T> containedValue, String errorCode)
T - the type of the listcontainedValue - the only value which is allowed in the listerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> contains(T containedValue, String errorCode)
T - the type of the listcontainedValue - the value which must exist in the listerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> contains(java.util.function.Supplier<T> containedValue, String errorCode)
T - the type of the listcontainedValue - the value which must exist in the listerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> doesNotContain(T excludedValue, String errorCode)
T - the type of the listexcludedValue - the value which mustn't exists in the listerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> doesNotContain(java.util.function.Supplier<T> excludedValue, String errorCode)
T - the type of the listexcludedValue - the value which mustn't exists in the listerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> isNotEmpty(String errorCode)
T - the type of the listerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> isEmpty(String errorCode)
T - the type of the listerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> hasSize(int size, String errorCode)
T - type of the listsize - the expected sizeerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> hasSize(java.util.function.Supplier<Integer> size, String errorCode)
T - type of the listsize - the expected sizeerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> hasMinSize(int size, String errorCode)
T - type of the listsize - the expected minimum sizeerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> hasMinSize(java.util.function.Supplier<Integer> size, String errorCode)
T - type of the listsize - the expected minimum sizeerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> hasMaxSize(int size, String errorCode)
T - type of the listsize - the expected maximum sizeerrorCode - error code used incase of an violationpublic static <T> Validation<List<T>> hasMaxSize(java.util.function.Supplier<Integer> size, String errorCode)
T - type of the listsize - the expected maximum sizeerrorCode - error code used incase of an violationpublic 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(String) ()},
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.