Class InputValidator

java.lang.Object
com.github.natche.gravatarjavaclient.utils.InputValidator

public final class InputValidator extends Object
A string validator used for validating parameter inputs.
  • Method Details

    • from

      public static InputValidator from(String input)
      Constructs a new input validator from the provided input.
      Parameters:
      input - the input
      Returns:
      a new InputValidator instance
      Throws:
      NullPointerException - if the provided input is null
      IllegalArgumentException - if the provided input is empty
    • isValidEmailAddress

      public boolean isValidEmailAddress()
      Returns whether the encapsulated input is a valid email address. Note, this does not check for existence, merely proper syntactical structure.
      Returns:
      whether the encapsulated input is a valid email address
    • isValidImageUrl

      public boolean isValidImageUrl()
      Returns whether the encapsulated input is a valid image URL. See ImageIO.read(URL) for more information.
      Returns:
      whether the encapsulated input is a valid image URL
    • equals

      public boolean equals(Object o)
      Returns whether the provided object equals this object.
      Overrides:
      equals in class Object
      Parameters:
      o - the other object
      Returns:
      whether the provided object equals this object
    • hashCode

      public int hashCode()
      Returns a hash code of this object.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code of this object
    • toString

      public String toString()
      Returns a string representation of this object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this object