upd: 规范格式

This commit is contained in:
骑着蜗牛追导弹 2024-12-06 21:11:54 +08:00
parent 3a0a233f6a
commit 18a02ef74f
4 changed files with 58 additions and 45 deletions

View File

@ -1,12 +1,19 @@
package cn.odboy.infra.validate; package cn.odboy.infra.validate;
import java.lang.annotation.*;
import javax.validation.Constraint; import javax.validation.Constraint;
import javax.validation.Payload; import javax.validation.Payload;
import java.lang.annotation.*;
@Documented @Documented
@Constraint(validatedBy = {MobileValidator.class}) @Constraint(validatedBy = {MobileValidator.class})
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE}) @Target({
ElementType.METHOD,
ElementType.FIELD,
ElementType.ANNOTATION_TYPE,
ElementType.CONSTRUCTOR,
ElementType.PARAMETER,
ElementType.TYPE_USE
})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface Mobile { public @interface Mobile {
boolean required() default false; boolean required() default false;

View File

@ -3,7 +3,6 @@ package cn.odboy.infra.validate;
import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.odboy.constant.RegexConst; import cn.odboy.constant.RegexConst;
import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext; import javax.validation.ConstraintValidatorContext;

View File

@ -1,12 +1,19 @@
package cn.odboy.infra.validate; package cn.odboy.infra.validate;
import java.lang.annotation.*;
import javax.validation.Constraint; import javax.validation.Constraint;
import javax.validation.Payload; import javax.validation.Payload;
import java.lang.annotation.*;
@Documented @Documented
@Constraint(validatedBy = {NotEmptyListValidator.class}) @Constraint(validatedBy = {NotEmptyListValidator.class})
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE}) @Target({
ElementType.METHOD,
ElementType.FIELD,
ElementType.ANNOTATION_TYPE,
ElementType.CONSTRUCTOR,
ElementType.PARAMETER,
ElementType.TYPE_USE
})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface NotEmptyList { public @interface NotEmptyList {
boolean required() default false; boolean required() default false;

View File

@ -1,8 +1,8 @@
package cn.odboy.infra.validate; package cn.odboy.infra.validate;
import java.util.List;
import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext; import javax.validation.ConstraintValidatorContext;
import java.util.List;
/** /**
* 校验列表长度 * 校验列表长度