Class ConstraintViolation


  • public class ConstraintViolation
    extends Object

    Represents a violation of a constraint. Captures a message describing the violation. Note there may be violations of several constraints during the validation of a property. All these violations are captured as separate ConstraintViolation objects and typically rolled up as part of an overall validation result.

    Copyright 2010 (C) by Martin Ganserer

    Version:
    1.0.0
    Author:
    Martin Ganserer
    • Constructor Detail

      • ConstraintViolation

        public ConstraintViolation​(String message)
        Constructor
        Parameters:
        message -
        Throws:
        IllegalArgumentException - if the message is null
    • Method Detail

      • getMessage

        public String getMessage()
        Text describing the violation. Note that applications do not necessarily need to make use of this message, as they have enough information to create their own messages. In particular they know the constraint that was violated and the value that violated the constraint. As such this message can be considered as a default message and is useful for logging etc.
        Returns:
        the message