T
- BigDecimal, BigInteger, Long, Integer, Double, Float@Component(value="cuba_PositiveOrZeroValidator") @Scope(value="prototype") public class PositiveOrZeroValidator<T extends java.lang.Number> extends AbstractValidator<T>
For error message it uses Groovy string and it is possible to use '$value' key for formatted output.
In order to provide your own implementation globally, create a subclass and register it in web-spring.xml
,
for example:
<bean id="cuba_PositiveOrZeroValidator" class="com.haulmont.cuba.gui.components.validation.PositiveOrZeroValidator" 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 |
---|
PositiveOrZeroValidator() |
PositiveOrZeroValidator(java.lang.String message)
Constructor for custom error message.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(T value) |
protected void |
setDatatypeRegistry(DatatypeRegistry datatypeRegistry) |
protected void |
setMessages(Messages messages) |
protected void |
setUserSessionSource(UserSessionSource userSessionSource) |
formatValue, getMessage, getTemplateErrorMessage, setMessage
public static final java.lang.String NAME
public PositiveOrZeroValidator()
public PositiveOrZeroValidator(java.lang.String message)
Example: "Value '$value' should be greater than or equal to 0".
message
- error message@Inject protected void setMessages(Messages messages)
@Inject protected void setDatatypeRegistry(DatatypeRegistry datatypeRegistry)
@Inject protected void setUserSessionSource(UserSessionSource userSessionSource)
public void accept(T value) throws ValidationException
ValidationException