T
- Collection or String@Component(value="cuba_NotEmptyValidator") @Scope(value="prototype") public class NotEmptyValidator<T> extends AbstractValidator<T>
For error message it uses Groovy 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 web-spring.xml
,
for example:
<bean id="cuba_NotEmptyValidator" class="com.haulmont.cuba.gui.components.validation.NotEmptyValidator" scope="prototype"/>Use
BeanLocator
when creating the validator programmatically.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
datatypeRegistry, message, messages, userSessionSource
Constructor and Description |
---|
NotEmptyValidator() |
NotEmptyValidator(java.lang.String message)
Constructor for custom error message.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(T value) |
protected void |
setMessages(Messages messages) |
formatValue, getMessage, getTemplateErrorMessage, setMessage
public static final java.lang.String NAME
public NotEmptyValidator()
public NotEmptyValidator(java.lang.String message)
message
- error message@Inject protected void setMessages(Messages messages)
public void accept(T value) throws ValidationException
ValidationException