T
- BigDecimal, BigInteger, Long, Integer, Double, Float@Component(value="ui_NegativeValidator") @Scope(value="prototype") public class NegativeValidator<T extends java.lang.Number> extends AbstractValidator<T>
For error message it uses template 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 configuration class, for example:
@Bean("ui_NegativeValidator") @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Primary protected NegativeValidator negativeValidator() { return new CustomNegativeValidator(); }
currentAuthentication, datatypeRegistry, message, messages, substitutor
Constructor and Description |
---|
NegativeValidator() |
NegativeValidator(java.lang.String message)
Constructor for custom error message.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(T value) |
void |
setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication) |
protected void |
setDatatypeRegistry(io.jmix.core.metamodel.datatype.DatatypeRegistry datatypeRegistry) |
protected void |
setMessages(io.jmix.core.Messages messages) |
void |
setStringSubstitutor(StringSubstitutor substitutor) |
formatValue, getMessage, getTemplateErrorMessage, setMessage
public NegativeValidator()
public NegativeValidator(java.lang.String message)
Example: "Value '${value}' should be less than 0".
message
- error message@Autowired protected void setMessages(io.jmix.core.Messages messages)
@Autowired protected void setDatatypeRegistry(io.jmix.core.metamodel.datatype.DatatypeRegistry datatypeRegistry)
@Autowired public void setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication)
@Autowired public void setStringSubstitutor(StringSubstitutor substitutor)
public void accept(T value) throws ValidationException
ValidationException