io.github.opensabre.common.web.validator.Mobile Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of opensabre-web Show documentation
Show all versions of opensabre-web Show documentation
OpenSabre Web project for Spring Boot
The newest version!
package io.github.opensabre.common.web.validator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* 中国手机号校验器
*/
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RUNTIME)
@Constraint(validatedBy = MobileValidator.class)//标明由哪个类执行校验逻辑
@Documented
public @interface Mobile {
/**
* 校验失败提示信息
*
* @return 校验失败提示信息
*/
String message() default "手机号格式错误";
Class>[] groups() default {};
Class extends Payload>[] payload() default {};
}