Class Validators


  • public final class Validators
    extends java.lang.Object
    校验工具
    Author:
    L.cm
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static javax.validation.Validator VALIDATOR  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Validators()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.Set<javax.validation.ConstraintViolation<T>> validate​(T object)
      Validates all constraints on object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VALIDATOR

        private static final javax.validation.Validator VALIDATOR
    • Constructor Detail

      • Validators

        private Validators()
    • Method Detail

      • validate

        public static <T> java.util.Set<javax.validation.ConstraintViolation<T>> validate​(T object)
        Validates all constraints on object.
        Type Parameters:
        T - the type of the object to validate
        Parameters:
        object - object to validate
        Returns:
        constraint violations or an empty set if none
        Throws:
        java.lang.IllegalArgumentException - if object is null or if null is passed to the varargs groups
        javax.validation.ValidationException - if a non recoverable error happens during the validation process