「-2147483648~2147483647整数であること」
上記の仕様がありますが
マイナス値を入れようとすると数字を入れてくださいとエラーが出ます。
負の整数を考慮するにはどうしたらよいでしょうか?
入力チェックは以下になっています。
@Number(groups = { Update.class })
@Max2(groups = { Update.class }, value = Integer.MAX_VALUE, allowBlank = true)
@Min2(groups = { Update.class }, value = Integer.MIN_VALUE, allowBlank = true)
MAX2 は以下になっています
/**
- 最大値チェック
*/
@Constraint(validatedBy = { Max2Validator.class })
@Documented
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
public @interface Max2 {
/** * メッセージ取得 * * @return メッセージ */ String message() default "{}"; /** * グループ取得 * * @return グループ */ Class<?>[] groups() default { }; /** * ペイロード取得 * * @return ペイロード */ Class<? extends Payload>[] payload() default { }; /** * @return value the element must be higher or equal to */ double value(); /** * @return signed of accepted */ boolean allowSign() default true; /** * @return blank of accepted */ boolean allowBlank() default true; /** * Defines several {@link Max2} annotations on the same element. * * @see Max2 */ @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) @Retention(RUNTIME) @Documented @interface List { /** * 設定値取得 * * @return 設定値 */ Max2[] value(); }
}