Class ValidatorAdapter

All Implemented Interfaces:
Processor, Adapter

public class ValidatorAdapter extends ProcessorAdapter
Adapts a Validator
Author:
Martin Krasser
  • Field Details

    • NEED_VALIDATION_HEADER_NAME

      public static final String NEED_VALIDATION_HEADER_NAME
      Validators may check whether the Camel message header is set and omit validation when it resolves to false.
  • Constructor Details

  • Method Details

    • staticProfile

      public ValidatorAdapter staticProfile(Object profile)
      Sets the profile to validate the input data against.
      Parameters:
      profile - validation profile.
      Returns:
      this object.
    • profile

      public ValidatorAdapter profile(Expression profileExpression)
      Sets the profile expression to validate the input data against. Sets an Expression for obtaining profile data from an Exchange. Profile data are passed to adapted transform-support-library objects.
      Parameters:
      profileExpression - validation profile expression.
      Returns:
      this object.
    • doProcess

      protected void doProcess(Exchange exchange, Object inputData, Object... inputParams)
      Delegates validation of input data against a profile to a Validator object.
      Specified by:
      doProcess in class ProcessorAdapter
      Parameters:
      exchange - message exchange where to write processing results.
      inputData - input data.
      inputParams - input parameters.
    • validationEnabled

      public static boolean validationEnabled(Exchange exchange)
      Parameters:
      exchange - Camel exchange containing the message to be validated.
      Returns:
      false if the message header NEED_VALIDATION_HEADER_NAME equals to Boolean.FALSE, true otherwise.