All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.opensabre.common.web.validator.Mobile Maven / Gradle / Ivy

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[] payload() default {};
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy