Interface Constraint

    • Method Detail

      • validate

        boolean validate​(Object object)
        Validates the given object against this constraint.

        If some object is null. Constraint should return true while validating unless the constraint deals with nullable state.

        Parameters:
        object - the object to validate
        Returns:
        true if the object was successfully validated, false otherwise
      • getErrorMessage

        String getErrorMessage​(Object invalidValue,
                               Locale locale)
        Provides an error message to display when some invalid value does not match existing entity.
        Parameters:
        invalidValue - The invalid value that don't match any entity.
        locale - The language in which the message should be generated.
        Returns:
        A message in the specified language or
        Since:
        7.1
      • getMessageKey

        String getMessageKey()
        Provides the message key.
        Returns:
        The message key
        Since:
        11.1
      • getDescription

        Constraint.Description getDescription()
        Provides a description of a constraint. For example, a constraint which control String format could return name=PatternMatchingConstraint | parameters= "pattern":"[0-9]+"
        Returns:
        The constraint description.
        Since:
        7.1