Interface Validator<T>

All Known Implementing Classes:
BlankStrategy, NotBlankStrategy, NullStrategy
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 Validator<T>
校验器接口
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

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

    • not

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

      boolean on(T object, Context context)
      校验对象
      Parameters:
      object - 被校验的对象
      context - 当前校验参数的上下文
      Returns:
      校验结果, true:校验通过