Developer Guide
Also available as:
PDF
loading table of contents...

Validating Processor Properties

A Processor is not able to be started if its configuration is not valid. Validation of a Processor property can be achieved by setting a Validator on a PropertyDescriptor or by restricting the allowable values for a property via the PropertyDescriptor.Builder's allowableValues method or identifiesControllerService method.

There are times, though, when validating a Processor's properties individually is not sufficient. For this purpose, the AbstractProcessor exposes a customValidate method. The method takes a single argument of type ValidationContext. The return value of this method is a Collection of ValidationResult objects that describe any problems that were found during validation. Only those ValidationResult objects whose isValid method returns false should be returned. This method will be invoked only if all properties are valid according to their associated Validators and Allowable Values. I.e., this method will be called only if all properties are valid in-and-of themselves, and this method allows for validation of a Processor's configuration as a whole.