Package com.clivern.decoy.util
Class Validate
- java.lang.Object
-
- com.clivern.decoy.util.Validate
-
public class Validate extends java.lang.ObjectValidate Class
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_DATE_FORMATstatic java.lang.StringDEFAULT_DATE_TIME_FORMATstatic java.lang.StringDEFAULT_TIME_FORMAT
-
Constructor Summary
Constructors Constructor Description Validate()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.BooleangreaterThan(java.lang.Float value, java.lang.Float minimum)Validate if number is greater than anotherstatic java.lang.BooleangreaterThan(java.lang.Integer value, java.lang.Integer minimum)Validate if integer is greater than anotherstatic java.lang.BooleangreaterThanEq(java.lang.Float value, java.lang.Float minimum)Validate if number is greater than or equal anotherstatic java.lang.BooleangreaterThanEq(java.lang.Integer value, java.lang.Integer minimum)Validate if integer is greater than or equal anotherstatic java.lang.BooleanisBoolean(java.lang.Object value)Validate if a value is booleanstatic java.lang.BooleanisDate(java.lang.String value)Validate Datestatic java.lang.BooleanisDate(java.lang.String value, java.lang.String format)Validate Datestatic java.lang.BooleanisDate(java.lang.String value, java.lang.String format, java.lang.Boolean strict)Validate Datestatic java.lang.BooleanisDatetime(java.lang.String value)Validate Datetimestatic java.lang.BooleanisDatetime(java.lang.String value, java.lang.String format)Validate Datetimestatic java.lang.BooleanisDatetime(java.lang.String value, java.lang.String format, java.lang.Boolean strict)Validate Datetimestatic java.lang.BooleanisEmail(java.lang.String value)Validate Emailstatic java.lang.BooleanisEmpty(java.lang.String value)Validate if a string is empty or notstatic java.lang.BooleanisInteger(java.lang.Object value)Validate if a value is integerstatic java.lang.BooleanisIpv4(java.lang.String value)Validate ipv4static java.lang.BooleanisIpv6(java.lang.String value)Validate ipv6static java.lang.BooleanisNull(java.lang.Object value)Validate if a value is nullstatic java.lang.BooleanisNumber(java.lang.Object value)Validate if a value is numberstatic java.lang.BooleanisString(java.lang.Object value)Validate if a value is stringstatic java.lang.BooleanisTime(java.lang.String value)Validate Timestatic java.lang.BooleanisTime(java.lang.String value, java.lang.String format)Validate Timestatic java.lang.BooleanisTime(java.lang.String value, java.lang.String format, java.lang.Boolean strict)Validate Timestatic java.lang.BooleanisURL(java.lang.String value)Validate URLstatic java.lang.BooleanisURL(java.lang.String value, java.lang.String[] schemes)Validate URLstatic java.lang.BooleanlengthBetween(java.lang.String value, int minLength, int maxLength)Validate String Length is between two valuesstatic java.lang.BooleanlengthEq(java.lang.String value, int length)Validate String Length equals a specific valuestatic java.lang.BooleanlengthLessThanEq(java.lang.String value, int maxLength)Validate String Length less than a specific valuestatic java.lang.BooleanlengthMoreThanEq(java.lang.String value, int minLength)Validate String Length more than a specific valuestatic java.lang.BooleanlessThan(java.lang.Float value, java.lang.Float maximum)Validate if number is less than anotherstatic java.lang.BooleanlessThan(java.lang.Integer value, java.lang.Integer maximum)Validate if integer is less than anotherstatic java.lang.BooleanlessThanEq(java.lang.Float value, java.lang.Float maximum)Validate if number is less than or equal anotherstatic java.lang.BooleanlessThanEq(java.lang.Integer value, java.lang.Integer maximum)Validate if integer is less than or equal anotherstatic java.lang.BooleanmultipleOf(java.lang.Float value, java.lang.Float factor)Validate if number is multipleOf a provided factorstatic java.lang.BooleanmultipleOf(java.lang.Integer value, java.lang.Integer factor)Validate if integer is multipleOf a provided factorstatic java.lang.Booleanregex(java.lang.String value, java.lang.String regex)Validate Against a Regex
-
-
-
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
-
-
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 valuelength- 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 valueminLength- minimum string lengthmaxLength- 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 valuemaxLength- 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 valueminLength- 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 valueregex- 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 valueformat- the date formatstrict- 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 valueformat- 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 valueformat- the date formatstrict- 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 valueformat- 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 valueformat- the date formatstrict- 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 valueformat- 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 valueschemes- 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 valueminimum- 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 valueminimum- 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 valueminimum- 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 valueminimum- 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 valuemaximum- 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 valuemaximum- 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 valuemaximum- 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 valuemaximum- 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 valuefactor- 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 valuefactor- the factor- Returns:
- whether integer is multipleOf a provided factor
-
-