@Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER})
@Retention(value=RUNTIME)
@Documented
@Constraint(validatedBy=Digits.DigitsValidator.class)
@Published
public @interface Digits
nullまたは空文字列の場合は、validと判定する。fraction()が未指定の場合は、fraction()を0として判定を行う。
つまり、入力値が整数であるかを判定することになる。
整数部3桁、小数部4桁の例を以下に示す。
public class SampleBean {
@Digits(integer = 3, fraction = 4)
String sampleString;
エラー時のメッセージは、以下のルールにより決定される。