Package ca.uhn.hl7v2.validation
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 TypeMethodDescriptionbooleanReturns a boolean flag indicating whether a validation was successful or not.voidonExceptions(ValidationException... exceptions) Called in case of validation rule violations.result()Returns an overall validation result based on an aggregation of all exceptions thrown during the validation process.voidsetValidationSubject(Object subject) Should be called before validation starts.
-
Method Details
-
onExceptions
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 ofresult()which may return a more complex object.- Returns:
- true if the validation is considered to be failed.
-