Class Validator.Result

  • Enclosing class:
    Validator<T>

    public class Validator.Result
    extends Object
    An instance of Result is returned from a Validator's validate method to indicate an invalid value.

    A Result can contain an error code and/or description. These values are for your own reporting purposes and are not used internally.

    • Constructor Detail

      • Result

        public Result​(Object errorCode,
                      String description)
        Creates a Result with the given error code and description.
        Parameters:
        errorCode - an error code for this Result, may be null
        description - a textual description of the Result, may be null
      • Result

        public Result​(Object errorCode,
                      String description,
                      String type)
        Creates a Result with the given error code and description.
        Parameters:
        errorCode - an error code for this Result, may be null
        description - a textual description of the Result, may be null
    • Method Detail

      • getErrorCode

        public Object getErrorCode()
        Returns the error code for the result, which may be null.
        Returns:
        the error code
      • getDescription

        public String getDescription()
        Returns a description of the validation result, which may be null.
        Returns:
        the description
      • getType

        public String getType()
      • toString

        public String toString()
        Returns a string representation of the Result. This method is intended to be used for debugging purposes only, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
        Overrides:
        toString in class Object
        Returns:
        a string representation of this Result