T
- BigDecimal, BigInteger, Long, Integer, Double, Float@Component(value="cuba_NegativeOrZeroValidator") @Scope(value="prototype") public class NegativeOrZeroValidator<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_NegativeOrZeroValidator" class="com.haulmont.cuba.gui.components.validation.NegativeOrZeroValidator" 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 |
---|
NegativeOrZeroValidator() |
NegativeOrZeroValidator(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 NegativeOrZeroValidator()
public NegativeOrZeroValidator(java.lang.String message)
Example: "Value '$value' should be less 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