Package io.jmix.ui.component.validation
Class NotEmptyValidator<T>
java.lang.Object
io.jmix.ui.component.validation.AbstractValidator<T>
io.jmix.ui.component.validation.NotEmptyValidator<T>
- Type Parameters:
T
- Collection or String
@Component("ui_NotEmptyValidator")
@Scope("prototype")
public class NotEmptyValidator<T>
extends AbstractValidator<T>
NotEmpty validator checks that value is not null and not empty.
For error message it uses template string and it is possible to use '${value}' keys for formatted output.
Note, that size validator for Collection doesn't use key 'value' for output error message.
In order to provide your own implementation globally, create a subclass and register it in configuration class, for example:
@Bean("ui_NotEmptyValidator") @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Primary protected NotEmptyValidator notEmptyValidator() { return new CustomNotEmptyValidator(); }
-
Field Summary
Fields inherited from class io.jmix.ui.component.validation.AbstractValidator
currentAuthentication, datatypeRegistry, message, messages, substitutor
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks a value.protected void
setMessages
(Messages messages) Methods inherited from class io.jmix.ui.component.validation.AbstractValidator
formatValue, getMessage, getTemplateErrorMessage, setMessage
-
Constructor Details
-
NotEmptyValidator
public NotEmptyValidator() -
NotEmptyValidator
Constructor for custom error message.- Parameters:
message
- error message
-
-
Method Details
-
setMessages
-
accept
Description copied from interface:Validator
Checks a value.- Parameters:
value
- a value- Throws:
ValidationException
-