Class ErrorTemplate<T>
- java.lang.Object
-
- be.sddevelopment.commons.validation.ErrorTemplate<T>
-
public class ErrorTemplate<T> extends Object
Description of file/class
Usage examples
Listfailures = 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.FailureBuilderfailure(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- aFunctionobject.- Returns:
- a
ErrorTemplateobject.
-
template
public static <S> ErrorTemplate<S> template()
template.
- Type Parameters:
S- a S object.- Returns:
- a
ErrorTemplateobject.
-
failure
public Failure.FailureBuilder failure(T data)
failure.
- Parameters:
data- a T object.- Returns:
- a
Failure.FailureBuilderobject.
-
-