Class AbstractJsonValidator<T>

java.lang.Object
org.qubership.nifi.processors.validator.AbstractJsonValidator<T>
Type Parameters:
T - defines type of output value, e.g. JsonNode.
All Implemented Interfaces:
org.apache.nifi.components.Validator
Direct Known Subclasses:
JsonClassValidator, JsonTreeValidator, JsonTypeReferenceValidator

public abstract class AbstractJsonValidator<T> extends Object implements org.apache.nifi.components.Validator
Abstract NiFi component validator for properties containing JSON.
  • Field Summary

    Fields inherited from interface org.apache.nifi.components.Validator

    INVALID, VALID
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract T
    Converts JSON string into JSON object.
    org.apache.nifi.components.ValidationResult
    validate(String subject, String input, org.apache.nifi.components.ValidationContext context)
     
    protected List<String>
    validate(T obj)
    Validates JSON object and returns a list of errors

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractJsonValidator

      public AbstractJsonValidator()
  • Method Details

    • validate

      public org.apache.nifi.components.ValidationResult validate(String subject, String input, org.apache.nifi.components.ValidationContext context)
      Specified by:
      validate in interface org.apache.nifi.components.Validator
    • convert

      protected abstract T convert(String json) throws IOException
      Converts JSON string into JSON object.
      Parameters:
      json - JSON string from property
      Returns:
      parsed JSON object
      Throws:
      IOException
    • validate

      protected List<String> validate(T obj)
      Validates JSON object and returns a list of errors
      Parameters:
      obj - input JSON object
      Returns:
      list of errors