public enum FieldValidator extends java.lang.Enum<FieldValidator>
IllegalArgumentException
if
the provided value does not pass validation.Enum Constant and Description |
---|
INSTANCE |
Modifier and Type | Method and Description |
---|---|
void |
nonNegative(java.lang.String fieldname,
java.lang.Long value)
Validates that
value is non-negative |
void |
notBlank(java.lang.String fieldname,
java.lang.String value)
Validates that
value is not blank |
void |
positive(java.lang.String fieldname,
java.lang.Float value)
Validates that
value is not positive |
void |
positive(java.lang.String fieldname,
java.lang.Integer value)
Validates that
value is positive |
void |
positive(java.lang.String fieldname,
java.lang.Long value)
Validates that
value is positive |
void |
validTimeString(java.lang.String fieldname,
java.lang.String timeString)
Validates that
value is a valid time string. |
static FieldValidator |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static FieldValidator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final FieldValidator INSTANCE
public static FieldValidator[] values()
for (FieldValidator c : FieldValidator.values()) System.out.println(c);
public static FieldValidator valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic void notBlank(java.lang.String fieldname, java.lang.String value)
value
is not blankfieldname
- the name of the field that is validated. This is used in the exception message.value
- the value to validatepublic void positive(java.lang.String fieldname, java.lang.Integer value)
value
is positivefieldname
- the name of the field that is validated. This is used in the exception message.value
- the value to validatepublic void positive(java.lang.String fieldname, java.lang.Float value)
value
is not positivefieldname
- the name of the field that is validated. This is used in the exception message.value
- the value to validatepublic void positive(java.lang.String fieldname, java.lang.Long value)
value
is positivefieldname
- the name of the field that is validated. This is used in the exception message.value
- the value to validatepublic void nonNegative(java.lang.String fieldname, java.lang.Long value)
value
is non-negativefieldname
- the name of the field that is validated. This is used in the exception message.value
- the value to validatepublic void validTimeString(java.lang.String fieldname, java.lang.String timeString)
value
is a valid time string. A valid time string is a number followed by the unit of time. The following units can be used:
s|second|seconds|mi|minute|minutes|h|hour|hours|d|day|days|w|week|weeks|mo|month|months|y|year|yearsfieldname
- the name of the field that is validated. This is used in the exception message.timeString
- the value to validate