Class HandlerBasedValidationListener

java.lang.Object
org.apache.jena.shacl.validation.HandlerBasedValidationListener
All Implemented Interfaces:
ValidationListener

public class HandlerBasedValidationListener extends Object implements ValidationListener

ValidationListener implementation that allows for registering event handlers on a per-type basis.

The handlers can be registered with any subclass or sub-interface of 'ValidationEvent', i.e., concrete event classes their superclasses or interfaces.

Example:
  ValidationListener myListener =
                         HandlerBasedValidationListener
                                         .builder()
                                         .forEventType(FocusNodeValidationStartedEvent.class)
                                         .addSimpleHandler(e -> {
                                              // ...
                                         })
                                         .forEventType(ConstraintEvaluatedEvent.class)
                                         .addSimpleHandler(e -> {
                                             // will be called for any subclass of ConstraintEvaluatedEvent
                                         })
                                         .build();