Interface ValidationExceptionHandler<R>

All Known Implementing Classes:
AbstractValidationExceptionHandler, CollectingValidationExceptionHandler, DefaultValidationExceptionHandler, ReportingValidationExceptionHandler, RespondingValidationExceptionHandler, SimpleValidationExceptionHandler

public interface ValidationExceptionHandler<R>
Handler that is called for every violation during a message validation.

Instances of this class are NOT thread safe as they collect data during the validation process.

Author:
Christian Ohr
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns a boolean flag indicating whether a validation was successful or not.
    void
    Called in case of validation rule violations.
    Returns an overall validation result based on an aggregation of all exceptions thrown during the validation process.
    void
    Should be called before validation starts.
  • Method Details

    • onExceptions

      void onExceptions(ValidationException... exceptions)
      Called in case of validation rule violations.
      Parameters:
      exceptions - the exceptions that describe the validatin errors
    • result

      Returns an overall validation result based on an aggregation of all exceptions thrown during the validation process. Often, this is a simple value indicating if any ValidationException has been thrown, but it can also be a complete response message that reflects the validation results.
      Returns:
      the validation result
      Throws:
      HL7Exception - if an error occurred during calculating the result
    • setValidationSubject

      Should be called before validation starts. Some ValidationHandler implementations may need context information of the subject being validated
      Parameters:
      subject - subject to be validated
    • hasFailed

      boolean hasFailed()
      Returns a boolean flag indicating whether a validation was successful or not. This is independent of result() which may return a more complex object.
      Returns:
      true if the validation is considered to be failed.