Interface ValidationMessage


  • public interface ValidationMessage

    Definition of an interface describing a validation message.

    If a Validator cannot successfully validate an input field, it creates a ValidationResult object that not only indicates the validation error, but also contains corresponding error messages to be displayed to the user. These error messages are represented by this interface.

    The idea behind this interface is that there can be multiple ways of obtaining the error message for the user. For instance it can be directly specified as text or loaded from the application's resources. By making use of an interface the actual source of the message is transparent for the client.

    A validation message consists of a text that can be directly displayed to the user. This text should be informative, so that the user knows what is wrong and how it can be fixed. The default validators shipped with this framework are able to provide meaningful error messages. In addition to the text, a validation message also contains a unique key. The existing validator implementations document the error keys they can produce. Further, a level for the severity of the message can be specified. The level determines whether the message is considered an error or not.

    Version:
    $Id: ValidationMessage.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • getKey

        String getKey()
        Returns the key of this validation message. Validation messages have a unique key. (This key can for instance be used for changing the text of a specific validation message.)
        Returns:
        the key of this validation message
      • getLevel

        ValidationMessageLevel getLevel()
        Returns the ValidationMessageLevel associated with this message. This level determines the severity of this message.
        Returns:
        the ValidationMessageLevel
      • getMessage

        String getMessage()
        Returns the actual message. This is a text that can be directly displayed to the user.
        Returns:
        the error message in plain text