Interface Validator<R>

All Known Implementing Classes:
AbstractValidator, DefaultValidator, MessageValidator

public interface Validator<R>
Interface to validates messages.
Author:
Bryan Tripp, Christian Ohr
  • Method Details

    • validate

      R validate(Message message) throws HL7Exception
      Validates a Message
      Parameters:
      message - message to be validated
      Returns:
      true if message is valid
      Throws:
      HL7Exception - if an unexpected error occurs while validating
      NullPointerException - if the message is null
    • validate

      R validate(String message, boolean isXML, String version) throws HL7Exception
      Validates a String representing an encoded message
      Parameters:
      message - message to be validated
      isXML - true if message is supposed to be XML
      version - message version
      Returns:
      true if message is valid
      Throws:
      HL7Exception - if an unexpected error occurs while validating
      NullPointerException - if the message is null
    • validate

      Validates a Message using a custom ValidationExceptionHandler. The handler provides the possibility to react on the outcome of the validation process and its individual steps, e.g. collecting all validation, issues, aggregating them to a single issue, logging, throwing exceptions etc.

      As the handler usually maintains state, a new instance is required for every validation call.

      Parameters:
      message - message to be validated
      handler - message validation handler
      Returns:
      true if message is valid
      Throws:
      HL7Exception - if an unexpected error occurs while validating
      NullPointerException - if the message or handler is null
    • validate

      R validate(String message, boolean isXML, String version, ValidationExceptionHandler<R> handler) throws HL7Exception
      Validates a String representing an encoded message. As the handler usually maintains state, a new instance is required for every validation call.
      Parameters:
      message - message to be validated
      isXML - true if message is supposed to be XML
      version - message version
      handler - message validation handler
      Returns:
      true if message is valid
      Throws:
      HL7Exception - if an unexpected error occurs while validating
      NullPointerException - if the message or handler is null