Class ErrorTemplate<T>
- java.lang.Object
-
- be.sddevelopment.commons.validation.ErrorTemplate<T>
-
public class ErrorTemplate<T> extends Object
Description of file/class
Usage examples
List
failures = Fallible.of("") .errorTemplate(template(s -> "The string [" + s + "] does not match rule: {%s}")) .ensure(StringUtils::isNotBlank, s -> b -> b.reason("Input can not be blank")) .failures(); - Since:
- 1.0.0
- Version:
- 1.0.0
- Author:
- Stijn Dejongh
-
-
Constructor Summary
Constructors Constructor Description ErrorTemplate(Function<T,String> template)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Failure.FailureBuilder
failure(T data)
failure.static <S> ErrorTemplate<S>
template()
template.static <S> ErrorTemplate<S>
template(Function<S,String> templateCreator)
template.
-
-
-
Method Detail
-
template
public static <S> ErrorTemplate<S> template(Function<S,String> templateCreator)
template.
- Type Parameters:
S
- a S object.- Parameters:
templateCreator
- aFunction
object.- Returns:
- a
ErrorTemplate
object.
-
template
public static <S> ErrorTemplate<S> template()
template.
- Type Parameters:
S
- a S object.- Returns:
- a
ErrorTemplate
object.
-
failure
public Failure.FailureBuilder failure(T data)
failure.
- Parameters:
data
- a T object.- Returns:
- a
Failure.FailureBuilder
object.
-
-