Annotation Type Numeric
Requires the component value to parse as a number, optionally within a
closed range. The processor emits
com.codename1.ui.validation.NumericConstraint(decimal, min, max, message)
into the Validator returned by Binding#getValidator().
@Bind(name="ageField") @Numeric(min = 0, max = 150)
private int age;
@Bind(name="priceField") @Numeric(decimal = true, min = 0.01)
private double price;
Bounds are inclusive. Omitting min / max removes that side of the
range (the defaults are negative / positive infinity).
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleantrueallows a decimal value (parsed viaDouble.parseDouble);falserequires an integer (parsed viaInteger.parseInt).doubleInclusive upper bound.Override the default error message (NumericConstraintderives one from the bounds when blank).doubleInclusive lower bound.
-
Element Details
-
decimal
boolean decimaltrueallows a decimal value (parsed viaDouble.parseDouble);falserequires an integer (parsed viaInteger.parseInt).- Default:
false
-
min
double minInclusive lower bound. Default: no lower bound.- Default:
-1.0/0.0
-
max
double maxInclusive upper bound. Default: no upper bound.- Default:
1.0/0.0
-
message
String messageOverride the default error message (NumericConstraintderives one from the bounds when blank).- Default:
""
-