m0_59717004
2022-06-26 16:40
采纳率: 100%
浏览 41
已结题

这是用idea写的三个组件 其中ismobile是主要组件 可以详细解释一下代码含义吗 有点不太明白(语言-java)

这是用idea写的三个组件 其中ismobile是主要组件 请求解释代码含义 基础较差 谢谢各位

img

img

img

图片转代码服务由CSDN问答提供 功能建议

   C B StudentController                                              * Created by zhoulan on 2022/6/18.
 b excption
                                      9
   5 ‘ GlobalExcption
                                     10          public class ValidatorUtil f
   C " GlobalExcptionHandle
 Bmapper
                                                    private static final Pattern mobile pattern = Pattern. compile("[i]([3-9]) [0-9]19}$");
                                     12
   D B ScoreMapper                                                 public static boolean isMobile(String mobile){
                                     B  O B StudentMapper                                                      if (StringUtils. isEmpty(mobile))1
   D G UserMapper                                   14                        return false;
 B pojo
   C  score                                   16                   Matcher matcher = mobile_pattern.matcher(mobile);
   C B student
                                                        return matcher.matchesO:
   CUser                                   18
 b service
                                     1
 Bimpl
                                     20
   D B lUserService
   D B StudentService
 b utils
   C B ValidatorUtil
 b Validator
   @ B isMobile
 ivo
   C B isMobileValidator
      " Loginy
 excption
                                    12
 5 B GlobalExcption
                                    13           @Target ((ElementType. METHOD, ElementType. FIELD, ElementType. ANNOTATION TYPE ElementType. CONSTI
 C " GlobalExcptionHandle
                                    14           @Retention (RetentionPolicy. RUNTIME)
 mapper
                                    15
 D % ScoreMapper                                              @Documented
                                    16  O B StudentMapper                                              @Constraint (
 D% UserMapper                                    17                     validatedBy ={ isMobileValidator.class j
 ipojo                                     18
 C % score                                    19           public @interface isMobile f
 C B student
                                                      表示必填
 C User
                                                   boolean requiredO default truei
 service                                    2
 Bimpl
 D B IUserService                                                   String message()default"手机号码格式错误";
 D ' StudentService
                                    25  lutils                                                @ Class<?>[] groupsO default O;
 C G ValidatorUtil                                    26
 Validator                                                    Class<? extends Payload>[j payloadO default O;
 @ isMobile
 IVO
                                    29
 C B isMobileValidator
 C LoginVo
 C B RestBean
 E G RestBeanEnum
    bStudentyo
 rexcption                                  12           * Created by zhoulan on 2022/6/18.
   5 G GlobalExcption
                                  13
   C e GlobalExcptionHandle
                                  14          public class isMobileValidator implements ConstraintValidator<isMobile, String> f
 Imapper
                                  15
   D ' ScoreMapper
                                                private boolean required = false:
                                  16  D B StudentMapper                                              COverride
                                  17  O% USERMAPPER                                             public boolean isValid (String s, ConstraintValidatorContext constraintValidatorContext)
 ·pojo                                  18                   if (required) f
  G score                               19                       return ValidatorUtil. isMobile(s) ;
   C% student                                                  felse f
   G% User
 b service
                                                        if (StringUtils. isEmpty(s)){
 Bimpl                                                            return false:
  D G IUserService                                                      Telse f
   D B StudentService                                                          return ValidatorUtil isMobile(s);
                                  %
 Butils
   C  Validatorutil
 b Validator                                   27
  @ isMobile
                                  28
 ·vo                                  29
                                                @Override
   C B isMobileValidator
                                  130of               public void initialize(isMobile constraintAnnotation) f required = constraintAnnotation, requiredO ; J
   C" LoginVo
  G B RestBean                                33
  E G RestBeanEnum
  C % StudentVo
   O% StuVo
   0Vo

2条回答 默认 最新

相关推荐 更多相似问题