Interface Matcher<T,K>

All Known Implementing Classes:
AlwaysStrategy, BlankStrategy, ChineseStrategy, CitizenIdStrategy, CompareStrategy, DateStrategy, EachStrategy, EmailStrategy, EnglishStrategy, EqualsStrategy, FalseStrategy, InEnumStrategy, InStrategy, IntRangeStrategy, IPAddressStrategy, LengthStrategy, MobileStrategy, MultiStrategy, NotBlankStrategy, NotInStrategy, NotNullStrategy, NullStrategy, PhoneStrategy, ReflectStrategy, RegexStrategy, TrueStrategy
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Matcher<T,K>
校验器接口
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T, K> Matcher<T,K>
    not(Matcher<T,K> matcher)
    根据校验器,创建相对立的一个校验器
    static <T> Matcher<T,?>
    of(Validator<T> validator)
    将Validator转为Matcher
    boolean
    on(T object, K annotation, Context context)
    校验对象
  • Method Details

    • of

      static <T> Matcher<T,?> of(Validator<T> validator)
      将Validator转为Matcher
      Type Parameters:
      T - Validator泛型
      Parameters:
      validator - Validator对象
      Returns:
      ComplexValidator对象
    • not

      static <T, K> Matcher<T,K> not(Matcher<T,K> matcher)
      根据校验器,创建相对立的一个校验器
      Type Parameters:
      T - 校验对象泛型
      K - 校验器注解泛型
      Parameters:
      matcher - 校验器
      Returns:
      新的校验器, 永远与传入参数的校验器的校验结果相反
    • on

      boolean on(T object, K annotation, Context context)
      校验对象
      Parameters:
      object - 被校验的对象
      annotation - 被校验对象的注解
      context - 校验环境上下文
      Returns:
      校验结果, true:校验通过