T
- Double and String that represents BigDouble value with current locale@Component(value="cuba_DoubleMinValidator") @Scope(value="prototype") public class DoubleMinValidator<T> extends AbstractValidator<T>
For error message it uses Groovy 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 web-spring.xml
,
for example:
<bean id="cuba_DoubleMinValidator" class="com.haulmont.cuba.gui.components.validation.DoubleMinValidator" scope="prototype"/>Use
BeanLocator
when creating the validator programmatically.Modifier and Type | Field and Description |
---|---|
protected boolean |
inclusive |
protected java.lang.Double |
min |
static java.lang.String |
NAME |
datatypeRegistry, message, messages, userSessionSource
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) |
protected void |
fireValidationException(T value) |
protected java.lang.String |
getDefaultMessage() |
java.lang.Double |
getMin() |
boolean |
isInclusive() |
protected void |
setDatatypeRegistry(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(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.
|
protected void |
setUserSessionSource(UserSessionSource userSessionSource) |
formatValue, getMessage, getTemplateErrorMessage, setMessage
public static final java.lang.String NAME
protected java.lang.Double min
protected boolean inclusive
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@Inject protected void setMessages(Messages messages)
@Inject protected void setDatatypeRegistry(DatatypeRegistry datatypeRegistry)
@Inject protected void setUserSessionSource(UserSessionSource userSessionSource)
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 optionpublic void setInclusive(boolean inclusive)
inclusive
- inclusive optionpublic boolean isInclusive()
public void accept(T value) throws ValidationException
ValidationException
protected java.lang.String getDefaultMessage()
protected void fireValidationException(T value)