Package io.jmix.ui.component.validation
Class AbstractValidator<T>
java.lang.Object
io.jmix.ui.component.validation.AbstractValidator<T>
- Type Parameters:
T
- value type
- Direct Known Subclasses:
DecimalMaxValidator
,DecimalMinValidator
,DigitsValidator
,DoubleMaxValidator
,DoubleMinValidator
,EmailValidator
,FutureOrPresentValidator
,FutureValidator
,GroovyScriptValidator
,JsonConfigValidator
,MaxValidator
,MinValidator
,NegativeOrZeroValidator
,NegativeValidator
,NotBlankValidator
,NotEmptyValidator
,NotNullValidator
,OutputFileNameValidator
,PastOrPresentValidator
,PastValidator
,PositiveOrZeroValidator
,PositiveValidator
,RegexpValidator
,ReportBandNameValidator
,ReportCollectionValidator
,ReportParamAliasValidator
,ReportParamFieldValidator
,SizeValidator
Main class for validators.
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentAuthentication
protected DatatypeRegistry
protected String
protected Messages
protected StringSubstitutor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
formatValue
(Object value) protected String
getTemplateErrorMessage
(String errorMessage, Map<String, Object> valuesMap) void
setMessage
(String message) Sets custom error message that will be used instead of default message.
-
Field Details
-
messages
-
currentAuthentication
-
datatypeRegistry
-
substitutor
-
message
-
-
Constructor Details
-
AbstractValidator
public AbstractValidator()
-
-
Method Details
-
getMessage
- Returns:
- custom error message
-
setMessage
Sets custom error message that will be used instead of default message. For error message it uses template string and it is possible to use values in message. Each validator has its own value keys for formatted output. See JavaDocs for specific validator.- Parameters:
message
- error message
-
getTemplateErrorMessage
protected String getTemplateErrorMessage(@Nullable String errorMessage, Map<String, Object> valuesMap) - Parameters:
errorMessage
- error messagevaluesMap
- values map- Returns:
- message with inserted values
-
formatValue
-