Class List Method List File List

# Class: VertxWebApiContract::CustomValidator

Inherits:
  Object
  - Object
  - VertxWebApiContract::CustomValidator
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/custom_validator.rb

## Overview

This interface is used to add custom synchronous functions inside validation process. You can add it in HTTPRequestValidationHandler.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (void) validate(routingContext = nil)
  This function have to be synchronous.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    19
    20
    21
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/custom_validator.rb', line 19

    def @@j_api_type.accept?(obj)
      obj.class == CustomValidator
    end

### + (`Object`) j_api_type

    28
    29
    30
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/custom_validator.rb', line 28

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    31
    32
    33
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/custom_validator.rb', line 31

    def self.j_class
      Java::IoVertxExtWebApiValidation::CustomValidator.java_class
    end

### + (`Object`) unwrap(obj)

    25
    26
    27
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/custom_validator.rb', line 25

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    22
    23
    24
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/custom_validator.rb', line 22

    def @@j_api_type.wrap(obj)
      CustomValidator.new(obj)
    end

## Instance Method Details

### - (`void`) validate(routingContext = nil)

This method returns an undefined value.

This function have to be synchronous. It doesn't return nothing if validation succedes, otherwise it throws ValidationException.
Don't call routingContext.next() or routingContext.fail() from this function

Parameters:

- routingContext (`::VertxWeb::RoutingContext`) (defaults to: `nil`) —
  the actual routing context

Raises:

- (`ArgumentError`)

    40
    41
    42
    43
    44
    45
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/custom_validator.rb', line 40

    def validate(routingContext=nil)
      if routingContext.class.method_defined?(:j_del) && !block_given?
        return @j_del.java_method(:validate, [Java::IoVertxExtWeb::RoutingContext.java_class]).call(routingContext.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling validate(#{routingContext})"
    end