Skip to content

Instantly share code, notes, and snippets.

@thiagomatar
Created December 8, 2020 12:31
Show Gist options
  • Save thiagomatar/13dbd39e47b505344335ca53d93c4753 to your computer and use it in GitHub Desktop.
Save thiagomatar/13dbd39e47b505344335ca53d93c4753 to your computer and use it in GitHub Desktop.
@Null - Checks value is null
@NotNull - Checks value is not null
@AssertTrue - Value is true
@AssertFalse - Value is false
@Min - Number is equal or higher
@Max - Number is equal or lessBuilt In Constraint Definitions
@DecimalMin - Value is larger
@DecimalMax - Value is less than
@Negative - Value is less than zero. Zero invalid.
@NegativeOrZero - Value is zero or less than zero
@Positive - Value is greater than zero. Zero invalid.
@PositiveOrZero - Value is zero or greater than zero.
@Size - checks if string or collection is between a min and maxBuilt In Constraint Definitions
@Digits - check for integer digits and fraction digits
@Past - Checks if date is in past
@PastOrPresent - Checks if date is in past or present
@Future - Checks if date is in future
@FutureOrPresent - Checks if date is present or in future
@Pattern - checks against RegEx patternBuilt In Constraint Definitions
@NotEmpty - Checks if value is null or empty (whitespace characters or empty collection)
@NonBlank - Checks string is not null or not whitespace characters
@Email - Checks if string value is an email addressHiberate Validator Constraints
@ScriptAssert - Class level annotation, checks class against script
@CreditCardNumber - Verifies value is a credit card number
@Currency - Valid currency amount
@DurationMax - Duration less than given value
@DurationMin - Duration greater than given value
@EAN - Valid EAN barcode
@ISBN - Valid ISBN valueHiberate Validator Constraints
@Length - String length between given min and max
@CodePointLength - Validates that code point length of the annotated character sequence is between min and max included.
@LuhnCheck - Luhn check sum
@Mod10Check - Mod 10 check sum
@Mod11Check - Mod 11 check sumHiberate Validator Constraints
@Range - checks if number is between given min and max (inclusive)
@SafeHtml - Checks for safe HTML
@UniqueElements - Checks if collection has unique elements
@Url - checks for valid URLHiberate Validator Country Constraints
@CNPJ - Brazilian Corporate Tax Payer Registry Number
@CPF - Brazilian Individual Taxpayer Registry Number
@TituloEleitoral - Brazilian voter ID
@NIP - Polish VAR ID
@PESEL - Polish National Validation Number
@REGON - Polish Taxpayer ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment