Class: VertxWebGraphql::GraphQLHandler

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graph_ql_handler.rb

Overview

A VertxWeb::Route handler for GraphQL requests.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)

18
19
20
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graph_ql_handler.rb', line 18

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

+ (Object) j_api_type


27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graph_ql_handler.rb', line 27

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class


30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graph_ql_handler.rb', line 30

def self.j_class
  Java::IoVertxExtWebHandlerGraphql::GraphQLHandler.java_class
end

+ (Object) unwrap(obj)


24
25
26
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graph_ql_handler.rb', line 24

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

+ (Object) wrap(obj)


21
22
23
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graph_ql_handler.rb', line 21

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

Instance Method Details

- (void) handle(event = nil)

This method returns an undefined value.

Something has happened, so handle it.

Parameters:

Raises:

  • (ArgumentError)

36
37
38
39
40
41
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graph_ql_handler.rb', line 36

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

- (self) query_context(factory = nil) { ... }

Customize the query context object. The provided factory method will be invoked for each incoming GraphQL request.

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

46
47
48
49
50
51
52
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-graphql/graph_ql_handler.rb', line 46

def query_context(factory=nil)
  if block_given? && factory == nil
    @j_del.java_method(:queryContext, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.safe_create(event,::VertxWeb::RoutingContext))) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling query_context(#{factory})"
end