Predefined validators

The validators specified here are registered at DataSift startup, and are always available to the user without further configuration.

  1. Boolean validators
  2. Double validators
  3. Float validators
  4. Integer validators
  5. String validators
  6. Iterating validators

Boolean validators

BooleanValue

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
expectedValuejava.lang.BooleanYes The boolean value to look for.
Data parameterTypeDescription
datajava.lang.Boolean Piece of data to be validated.

Double validators

DoubleInRange

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
minValuejava.lang.DoubleNoDouble.MIN_VALUE Minimum value of the number in the data object for the validation to succeed.
maxValuejava.lang.DoubleNoDouble.MAX_VALUE Maximum value of the number in the data object for the validation to succeed.
Data parameterTypeDescription
datajava.lang.Double Piece of data to be validated.

Float validators

FloatInRange

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
minValuejava.lang.FloatNoFloat.MIN_VALUE Minimum value of the number in the data object for the validation to succeed.
maxValuejava.lang.IntegerNoFloat.MAX_VALUE Maximum value of the number in the data object for the validation to succeed.
Data parameterTypeDescription
datajava.lang.Float Piece of data to be validated.

Integer validators

IntegerInRange

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
minValuejava.lang.IntegerNoInteger.MIN_VALUE Minimum value of the number in the data object for the validation to succeed.
maxValuejava.lang.IntegerNoInteger.MAX_VALUE Maximum value of the number in the data object for the validation to succeed.
Data parameterTypeDescription
datajava.lang.Integer Piece of data to be validated.

String validators

StringIsBoolean

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
expectedValuejava.lang.BooleanNo If the String is a correct boolean value, allows to check for a specific value (true or false).
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated.

StringIsDate

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
patternjava.lang.StringYes Date pattern to use for matching. This pattern will be defined as specified in java.text.SimpleDateFormat.
localejava.lang.StringNo(Default locale) Locale to be used for date constants (month names, etc). For instance: "es", "es_ES", "es_ES.UTF-8"...
allowedDatesjava.lang.String[]NoANY Dates that will be allowed. Possible values are:
  • ANY: Any date which matches the pattern will be valid.
  • PAST: Only dates which match the pattern and are in the past will be valid.
  • PRESENT: Only dates which match the pattern and refer to the present moment will be valid.
  • FUTURE: Only dates which match the pattern and are in the future will be valid.
This values can be combined. For instance: "PAST PRESENT", "PRESENT FUTURE",...

Only the date fields present in the specified pattern will be used for comparison.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated.

StringIsInteger

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
minValuejava.lang.IntegerNoInteger.MIN_VALUE Minimum value of the number in the String object for the validation to succeed.
maxValuejava.lang.IntegerNoInteger.MAX_VALUE Maximum value of the number in the String object for the validation to succeed.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated.

StringIsDouble

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
minValuejava.lang.DoubleNoDouble.MIN_VALUE Minimum value of the number in the String object for the validation to succeed.
maxValuejava.lang.DoubleNoDouble.MAX_VALUE Maximum value of the number in the String object for the validation to succeed.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated.

StringIsEmail

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated. Validation will succeed if the string is an email address.

StringIsFloat

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
minValuejava.lang.FloatNoFloat.MIN_VALUE Minimum value of the number in the String object for the validation to succeed.
maxValuejava.lang.FloatNoFloat.MAX_VALUE Maximum value of the number in the String object for the validation to succeed.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated.

StringIsUrl

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated (will be valid if String conforms to a URL specification as defined in java.net.URL).

StringLength

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
minLengthjava.lang.IntegerNo0 Minimum length of the String for the validation to succeed.
maxLengthjava.lang.IntegerNoInteger.MAX_VALUE Maximum length of the String for the validation to succeed.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated.

StringMatchPattern

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
patternjava.lang.StringYes Pattern (java.util.regex.Pattern style) against which the string will be tried to match.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated.

StringNotEmpty

Config parameterTypeRequiredDefault valueDescription
trimjava.lang.BooleanNoBoolean.TRUE Trim the String before checking it.
Data parameterTypeDescription
datajava.lang.String Piece of data to be validated.

Iterating validators

ArrayIterator

This validator performs all its nested validations on every item of an array of objects (applying an ObjectResolver to each of the array items).

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
successConditionjava.lang.StringNoAND Condition to apply on the results of the iteration items. Possible values:
  • AND: All the items must validate OK.
  • OR: At least one item must validate OK.
  • EXOR: Only one item must validate OK.
  • NEXOR: Either none or all of the items must validate OK.
Data parameterTypeDescription
datajava.lang.Object[] Piece of data to be validated.

CollectionIterator

This validator performs all its nested validations on every item of a Collection (applying an ObjectResolver to each of the Collection items).

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
successConditionjava.lang.StringNoAND Condition to apply on the results of the iteration items. Possible values:
  • AND: All the items must validate OK.
  • OR: At least one item must validate OK.
  • EXOR: Only one item must validate OK.
  • NEXOR: Either none or all of the items must validate OK.
Data parameterTypeDescription
datajava.util.Collection Piece of data to be validated.

MapIterator

This validator performs all its nested validations on every entry of a Map (applying a MapEntryResolver to each of the Map entries).

Config parameterTypeRequiredDefault valueDescription
acceptNulljava.lang.BooleanNoBoolean.FALSE If true validation will succeed if the data parameter is null.
successConditionjava.lang.StringNoAND Condition to apply on the results of the iteration items. Possible values:
  • AND: All the items must validate OK.
  • OR: At least one item must validate OK.
  • EXOR: Only one item must validate OK.
  • NEXOR: Either none or all of the items must validate OK.
Data parameterTypeDescription
datajava.util.Map Piece of data to be validated.