Class Validate


  • public class Validate
    extends java.lang.Object
    Validate Class
    • Constructor Summary

      Constructors 
      Constructor Description
      Validate()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Boolean greaterThan​(java.lang.Float value, java.lang.Float minimum)
      Validate if number is greater than another
      static java.lang.Boolean greaterThan​(java.lang.Integer value, java.lang.Integer minimum)
      Validate if integer is greater than another
      static java.lang.Boolean greaterThanEq​(java.lang.Float value, java.lang.Float minimum)
      Validate if number is greater than or equal another
      static java.lang.Boolean greaterThanEq​(java.lang.Integer value, java.lang.Integer minimum)
      Validate if integer is greater than or equal another
      static java.lang.Boolean isBoolean​(java.lang.Object value)
      Validate if a value is boolean
      static java.lang.Boolean isDate​(java.lang.String value)
      Validate Date
      static java.lang.Boolean isDate​(java.lang.String value, java.lang.String format)
      Validate Date
      static java.lang.Boolean isDate​(java.lang.String value, java.lang.String format, java.lang.Boolean strict)
      Validate Date
      static java.lang.Boolean isDatetime​(java.lang.String value)
      Validate Datetime
      static java.lang.Boolean isDatetime​(java.lang.String value, java.lang.String format)
      Validate Datetime
      static java.lang.Boolean isDatetime​(java.lang.String value, java.lang.String format, java.lang.Boolean strict)
      Validate Datetime
      static java.lang.Boolean isEmail​(java.lang.String value)
      Validate Email
      static java.lang.Boolean isEmpty​(java.lang.String value)
      Validate if a string is empty or not
      static java.lang.Boolean isInteger​(java.lang.Object value)
      Validate if a value is integer
      static java.lang.Boolean isIpv4​(java.lang.String value)
      Validate ipv4
      static java.lang.Boolean isIpv6​(java.lang.String value)
      Validate ipv6
      static java.lang.Boolean isNull​(java.lang.Object value)
      Validate if a value is null
      static java.lang.Boolean isNumber​(java.lang.Object value)
      Validate if a value is number
      static java.lang.Boolean isString​(java.lang.Object value)
      Validate if a value is string
      static java.lang.Boolean isTime​(java.lang.String value)
      Validate Time
      static java.lang.Boolean isTime​(java.lang.String value, java.lang.String format)
      Validate Time
      static java.lang.Boolean isTime​(java.lang.String value, java.lang.String format, java.lang.Boolean strict)
      Validate Time
      static java.lang.Boolean isURL​(java.lang.String value)
      Validate URL
      static java.lang.Boolean isURL​(java.lang.String value, java.lang.String[] schemes)
      Validate URL
      static java.lang.Boolean lengthBetween​(java.lang.String value, int minLength, int maxLength)
      Validate String Length is between two values
      static java.lang.Boolean lengthEq​(java.lang.String value, int length)
      Validate String Length equals a specific value
      static java.lang.Boolean lengthLessThanEq​(java.lang.String value, int maxLength)
      Validate String Length less than a specific value
      static java.lang.Boolean lengthMoreThanEq​(java.lang.String value, int minLength)
      Validate String Length more than a specific value
      static java.lang.Boolean lessThan​(java.lang.Float value, java.lang.Float maximum)
      Validate if number is less than another
      static java.lang.Boolean lessThan​(java.lang.Integer value, java.lang.Integer maximum)
      Validate if integer is less than another
      static java.lang.Boolean lessThanEq​(java.lang.Float value, java.lang.Float maximum)
      Validate if number is less than or equal another
      static java.lang.Boolean lessThanEq​(java.lang.Integer value, java.lang.Integer maximum)
      Validate if integer is less than or equal another
      static java.lang.Boolean multipleOf​(java.lang.Float value, java.lang.Float factor)
      Validate if number is multipleOf a provided factor
      static java.lang.Boolean multipleOf​(java.lang.Integer value, java.lang.Integer factor)
      Validate if integer is multipleOf a provided factor
      static java.lang.Boolean regex​(java.lang.String value, java.lang.String regex)
      Validate Against a Regex
      • Methods inherited from class java.lang.Object

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

      • DEFAULT_DATE_FORMAT

        public static final java.lang.String DEFAULT_DATE_FORMAT
        See Also:
        Constant Field Values
      • DEFAULT_TIME_FORMAT

        public static final java.lang.String DEFAULT_TIME_FORMAT
        See Also:
        Constant Field Values
      • DEFAULT_DATE_TIME_FORMAT

        public static final java.lang.String DEFAULT_DATE_TIME_FORMAT
        See Also:
        Constant Field Values
    • Constructor Detail

      • Validate

        public Validate()
    • Method Detail

      • isString

        public static java.lang.Boolean isString​(java.lang.Object value)
        Validate if a value is string
        Parameters:
        value - field value
        Returns:
        whether field is string or not
      • isInteger

        public static java.lang.Boolean isInteger​(java.lang.Object value)
        Validate if a value is integer
        Parameters:
        value - field value
        Returns:
        whether field is integer or not
      • isNumber

        public static java.lang.Boolean isNumber​(java.lang.Object value)
        Validate if a value is number
        Parameters:
        value - field value
        Returns:
        whether field is number or not
      • isBoolean

        public static java.lang.Boolean isBoolean​(java.lang.Object value)
        Validate if a value is boolean
        Parameters:
        value - field value
        Returns:
        whether field is boolean or not
      • isNull

        public static java.lang.Boolean isNull​(java.lang.Object value)
        Validate if a value is null
        Parameters:
        value - field value
        Returns:
        whether field is null or not
      • isEmpty

        public static java.lang.Boolean isEmpty​(java.lang.String value)
        Validate if a string is empty or not
        Parameters:
        value - field value
        Returns:
        whether field is empty or nor
      • lengthEq

        public static java.lang.Boolean lengthEq​(java.lang.String value,
                                                 int length)
        Validate String Length equals a specific value
        Parameters:
        value - field value
        length - string length
        Returns:
        whether field is valid or not
      • lengthBetween

        public static java.lang.Boolean lengthBetween​(java.lang.String value,
                                                      int minLength,
                                                      int maxLength)
        Validate String Length is between two values
        Parameters:
        value - field value
        minLength - minimum string length
        maxLength - maximum string length
        Returns:
        whether field is valid or not
      • lengthLessThanEq

        public static java.lang.Boolean lengthLessThanEq​(java.lang.String value,
                                                         int maxLength)
        Validate String Length less than a specific value
        Parameters:
        value - field value
        maxLength - maximum string length
        Returns:
        whether field is valid or not
      • lengthMoreThanEq

        public static java.lang.Boolean lengthMoreThanEq​(java.lang.String value,
                                                         int minLength)
        Validate String Length more than a specific value
        Parameters:
        value - field value
        minLength - minimum string length
        Returns:
        whether field is valid or not
      • regex

        public static java.lang.Boolean regex​(java.lang.String value,
                                              java.lang.String regex)
        Validate Against a Regex
        Parameters:
        value - field value
        regex - the regex to validate against
        Returns:
        whether field is valid or not
      • isDatetime

        public static java.lang.Boolean isDatetime​(java.lang.String value,
                                                   java.lang.String format,
                                                   java.lang.Boolean strict)
        Validate Datetime
        Parameters:
        value - field value
        format - the date format
        strict - whether a strict validation
        Returns:
        whether field is valid or not
      • isDatetime

        public static java.lang.Boolean isDatetime​(java.lang.String value,
                                                   java.lang.String format)
        Validate Datetime
        Parameters:
        value - field value
        format - the date format
        Returns:
        whether field is valid or not
      • isDatetime

        public static java.lang.Boolean isDatetime​(java.lang.String value)
        Validate Datetime
        Parameters:
        value - field value
        Returns:
        whether field is valid or not
      • isDate

        public static java.lang.Boolean isDate​(java.lang.String value,
                                               java.lang.String format,
                                               java.lang.Boolean strict)
        Validate Date
        Parameters:
        value - field value
        format - the date format
        strict - whether a strict validation
        Returns:
        whether field is valid or not
      • isDate

        public static java.lang.Boolean isDate​(java.lang.String value,
                                               java.lang.String format)
        Validate Date
        Parameters:
        value - field value
        format - the date format
        Returns:
        whether field is valid or not
      • isDate

        public static java.lang.Boolean isDate​(java.lang.String value)
        Validate Date
        Parameters:
        value - field value
        Returns:
        whether field is valid or not
      • isTime

        public static java.lang.Boolean isTime​(java.lang.String value,
                                               java.lang.String format,
                                               java.lang.Boolean strict)
        Validate Time
        Parameters:
        value - field value
        format - the date format
        strict - whether a strict validation
        Returns:
        whether field is valid or not
      • isTime

        public static java.lang.Boolean isTime​(java.lang.String value,
                                               java.lang.String format)
        Validate Time
        Parameters:
        value - field value
        format - the date format
        Returns:
        whether field is valid or not
      • isTime

        public static java.lang.Boolean isTime​(java.lang.String value)
        Validate Time
        Parameters:
        value - field value
        Returns:
        whether field is valid or not
      • isEmail

        public static java.lang.Boolean isEmail​(java.lang.String value)
        Validate Email
        Parameters:
        value - field value
        Returns:
        whether field is valid or not
      • isIpv4

        public static java.lang.Boolean isIpv4​(java.lang.String value)
        Validate ipv4
        Parameters:
        value - field value
        Returns:
        whether field is valid or not
      • isIpv6

        public static java.lang.Boolean isIpv6​(java.lang.String value)
        Validate ipv6
        Parameters:
        value - field value
        Returns:
        whether field is valid or not
      • isURL

        public static java.lang.Boolean isURL​(java.lang.String value,
                                              java.lang.String[] schemes)
        Validate URL
        Parameters:
        value - field value
        schemes - the url scheme
        Returns:
        whether field is valid or not
      • isURL

        public static java.lang.Boolean isURL​(java.lang.String value)
        Validate URL
        Parameters:
        value - field value
        Returns:
        whether field is valid or not
      • greaterThan

        public static java.lang.Boolean greaterThan​(java.lang.Float value,
                                                    java.lang.Float minimum)
        Validate if number is greater than another
        Parameters:
        value - field value
        minimum - the minimum value
        Returns:
        whether value is greater than the minimum
      • greaterThan

        public static java.lang.Boolean greaterThan​(java.lang.Integer value,
                                                    java.lang.Integer minimum)
        Validate if integer is greater than another
        Parameters:
        value - field value
        minimum - the minimum value
        Returns:
        whether integer is greater than the minimum
      • greaterThanEq

        public static java.lang.Boolean greaterThanEq​(java.lang.Float value,
                                                      java.lang.Float minimum)
        Validate if number is greater than or equal another
        Parameters:
        value - field value
        minimum - the minimum value
        Returns:
        whether value is greater than or equal the minimum
      • greaterThanEq

        public static java.lang.Boolean greaterThanEq​(java.lang.Integer value,
                                                      java.lang.Integer minimum)
        Validate if integer is greater than or equal another
        Parameters:
        value - field value
        minimum - the minimum value
        Returns:
        whether integer is greater than or equal the minimum
      • lessThan

        public static java.lang.Boolean lessThan​(java.lang.Float value,
                                                 java.lang.Float maximum)
        Validate if number is less than another
        Parameters:
        value - field value
        maximum - the maximum value
        Returns:
        whether value is less than the maximum
      • lessThan

        public static java.lang.Boolean lessThan​(java.lang.Integer value,
                                                 java.lang.Integer maximum)
        Validate if integer is less than another
        Parameters:
        value - field value
        maximum - the maximum value
        Returns:
        whether integer is less than the maximum
      • lessThanEq

        public static java.lang.Boolean lessThanEq​(java.lang.Float value,
                                                   java.lang.Float maximum)
        Validate if number is less than or equal another
        Parameters:
        value - field value
        maximum - the maximum value
        Returns:
        whether value is less than or equal the maximum
      • lessThanEq

        public static java.lang.Boolean lessThanEq​(java.lang.Integer value,
                                                   java.lang.Integer maximum)
        Validate if integer is less than or equal another
        Parameters:
        value - field value
        maximum - the maximum value
        Returns:
        whether integer is less than or equal the maximum
      • multipleOf

        public static java.lang.Boolean multipleOf​(java.lang.Float value,
                                                   java.lang.Float factor)
        Validate if number is multipleOf a provided factor
        Parameters:
        value - field value
        factor - the factor
        Returns:
        whether number is multipleOf a provided factor
      • multipleOf

        public static java.lang.Boolean multipleOf​(java.lang.Integer value,
                                                   java.lang.Integer factor)
        Validate if integer is multipleOf a provided factor
        Parameters:
        value - field value
        factor - the factor
        Returns:
        whether integer is multipleOf a provided factor