T
- Double and String that represents BigDouble value with current locale@Component(value="ui_DoubleMinValidator") @Scope(value="prototype") public class DoubleMinValidator<T> extends AbstractValidator<T>
For error message it uses template string and it is possible to use '${value}' and '${min}' keys for formatted output.
In order to provide your own implementation globally, create a subclass and register it in configuration class, for example:
@Bean("ui_DoubleMinValidator") @Scope(BeanDefinition.SCOPE_PROTOTYPE) @Primary protected DoubleMinValidator doubleMinValidator(Double min) { return new CustomDoubleMinValidator(min); }
Modifier and Type | Field and Description |
---|---|
protected boolean |
inclusive |
protected java.lang.Double |
min |
currentAuthentication, datatypeRegistry, message, messages, substitutor
Constructor and Description |
---|
DoubleMinValidator(java.lang.Double min)
Constructor with default error message.
|
DoubleMinValidator(java.lang.Double min,
java.lang.String message)
Constructor with custom error message.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(T value)
Checks a value.
|
protected void |
fireValidationException(T value) |
protected java.lang.String |
getDefaultMessage() |
java.lang.Double |
getMin() |
boolean |
isInclusive() |
void |
setCurrentAuthentication(io.jmix.core.security.CurrentAuthentication currentAuthentication) |
protected void |
setDatatypeRegistry(io.jmix.core.metamodel.datatype.DatatypeRegistry datatypeRegistry) |
void |
setInclusive(boolean inclusive)
Set to true if the value must be greater than or equal to the specified minimum.
|
protected void |
setMessages(io.jmix.core.Messages messages) |
void |
setMin(java.lang.Double min)
Sets min value.
|
void |
setMin(java.lang.Double min,
boolean inclusive)
Sets min value and inclusive option.
|
void |
setStringSubstitutor(StringSubstitutor substitutor) |
formatValue, getMessage, getTemplateErrorMessage, setMessage
public DoubleMinValidator(java.lang.Double min)
min
- min valuepublic DoubleMinValidator(java.lang.Double min, java.lang.String message)
Example: "Value '${value}' should be greater than or equal to '${min}'".
min
- min valuemessage
- 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)
@StudioProperty(name="value", required=true) public void setMin(java.lang.Double min)
min
- min valuepublic java.lang.Double getMin()
public void setMin(java.lang.Double min, boolean inclusive)
min
- min valueinclusive
- inclusive option@StudioProperty public void setInclusive(boolean inclusive)
inclusive
- inclusive optionpublic boolean isInclusive()
public void accept(T value) throws ValidationException
Validator
value
- a valueValidationException
protected java.lang.String getDefaultMessage()
protected void fireValidationException(T value)