Thursday 11 March 2021

Java Bean validation tutorial


      JSR 380 (hibernate-validator)
      Setting up Environment for hibernate-validator
      Hello World application
      Built-in constraints
      @AssertFalse: Validate falsity of the element
      @AssertTrue: Validate trueness of the element
      @DecimalMax: Value must be <= this value
      DecimalMin: Value must be >= this value
      Digits: Number must be within accepted range
      Email: validate email
      Future: Element must represent a future instant, date or time
      Past: Element must represent a past instant, date or time.
      PastOrPresent: Element must represent a past or current instant, date or time
      FutureOrPresent: Validate present or future date
      @Max: Value must be less than or equal to this number
      @Min: Value must be greater than or equal to this number
      @Negative: Number must be negative
      NegativeOrZero: Number must be negative or zero
      Positive: Number must be > 0
      PositiveOrZero: Number must be >= 0
      NotBlank: File should not be null and contain atleast one non-whitespace character
      NotEmpty: Element must not be null or empty
      @NotNull: Element must not be null
      @Null: Element must be null
      @Pattern: Match to given regular expression
      Size: size must be between the specified boundaries
      Create Custom Composite Constraint
      Create custom validation constraint
      customize Error Messages
      Customize error message using message attribute
      Configure validation error messages globally
      Internationalize Error Messages


Previous                                                    Next                                                    Home

No comments:

Post a Comment