Class DigitsValidator<T>
java.lang.Object
io.jmix.flowui.component.validation.AbstractValidator<T>
io.jmix.flowui.component.validation.DigitsValidator<T>
- All Implemented Interfaces:
Validator<T>
,Consumer<T>
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
@Component("flowui_DigitsValidator")
@Scope("prototype")
public class DigitsValidator<T>
extends AbstractValidator<T>
implements org.springframework.beans.factory.InitializingBean
-
Field Summary
Fields inherited from class io.jmix.flowui.component.validation.AbstractValidator
applicationContext, currentAuthentication, datatypeRegistry, defaultMessage, message, messages, substitutor
-
Constructor Summary
ConstructorDescriptionDigitsValidator
(int integer, int fraction) Constructor with default error message.DigitsValidator
(int integer, int fraction, String message) Constructor with custom error message. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks a value.protected void
fireValidationException
(T value) int
int
void
setFraction
(int fraction) Sets maximum value inclusive.void
setInteger
(int integer) Sets maximum value inclusive.Methods inherited from class io.jmix.flowui.component.validation.AbstractValidator
afterPropertiesSet, fireValidationException, fireValidationException, formatValue, getMessage, getTemplateErrorMessage, setApplicationContext, setMessage
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
-
Field Details
-
integer
protected int integer -
fraction
protected int fraction
-
-
Constructor Details
-
DigitsValidator
public DigitsValidator() -
DigitsValidator
public DigitsValidator(int integer, int fraction) Constructor with default error message.- Parameters:
integer
- maximum number of integral digitsfraction
- maximum number of fractional digits
-
DigitsValidator
Constructor with custom error message. This message can contain '${value}', '${integer}' and '${fraction}' keys for formatted output.Example: "Value '${value}' is out of bounds ('${integer}' digits is expected in integer part and '${fraction}' in fractional part)".
- Parameters:
integer
- maximum number of integral digitsfraction
- maximum number of fractional digitsmessage
- error message
-
-
Method Details
-
setInteger
public void setInteger(int integer) Sets maximum value inclusive.- Parameters:
integer
- maximum number of integral digits
-
setFraction
public void setFraction(int fraction) Sets maximum value inclusive.- Parameters:
fraction
- maximum number of fractional digits
-
getInteger
public int getInteger()- Returns:
- maximum number of integral digits
-
getFraction
public int getFraction()- Returns:
- maximum number of fractional digits
-
accept
Description copied from interface:Validator
Checks a value. -
fireValidationException
-