Class: VertxBridgeCommon::BaseBridgeEvent
- Inherits:
-
Vertx::Promise
show all
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb
Overview
Represents an event that occurs on the event bus bridge.
Please consult the documentation for a full explanation.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
promise
Class Method Details
+ (Boolean) accept?(obj)
22
23
24
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 22
def @@j_api_type.accept?(obj)
obj.class == BaseBridgeEvent
end
|
+ (Object) j_api_type
31
32
33
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 31
def self.j_api_type
@@j_api_type
end
|
+ (Object) j_class
34
35
36
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 34
def self.j_class
Java::IoVertxExtBridge::BaseBridgeEvent.java_class
end
|
+ (Object) unwrap(obj)
28
29
30
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 28
def @@j_api_type.unwrap(obj)
obj.j_del
end
|
+ (Object) wrap(obj)
25
26
27
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 25
def @@j_api_type.wrap(obj)
BaseBridgeEvent.new(obj)
end
|
Instance Method Details
- (void) complete(result = nil)
This method returns an undefined value.
Set the result. Any handler will be called, if there is one, and the promise will be marked as completed.
Any handler set on the associated promise will be called.
42
43
44
45
46
47
48
49
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 42
def complete(result=nil)
if !block_given? && result == nil
return @j_del.java_method(:complete, []).call()
elsif (result.class == TrueClass || result.class == FalseClass) && !block_given?
return @j_del.java_method(:complete, [Java::JavaLang::Boolean.java_class]).call(result)
end
raise ArgumentError, "Invalid arguments when calling complete(#{result})"
end
|
- (void) fail(cause)
- (void) fail(message)
56
57
58
59
60
61
62
63
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 56
def fail(param_1=nil)
if param_1.is_a?(Exception) && !block_given?
return @j_del.java_method(:fail, [Java::JavaLang::Throwable.java_class]).call(::Vertx::Util::Utils.to_throwable(param_1))
elsif param_1.class == String && !block_given?
return @j_del.java_method(:fail, [Java::java.lang.String.java_class]).call(param_1)
end
raise ArgumentError, "Invalid arguments when calling fail(#{param_1})"
end
|
Returns the associated with this promise, it can be used to be aware of the promise completion
91
92
93
94
95
96
97
98
99
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 91
def future
if !block_given?
if @cached_future != nil
return @cached_future
end
return @cached_future = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:future, []).call(),::Vertx::Future, nil)
end
raise ArgumentError, "Invalid arguments when calling future()"
end
|
- (Hash{String => Object}) get_raw_message
Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is
no message involved. If the returned message is modified,
#set_raw_message should be called with the
new message.
114
115
116
117
118
119
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 114
def get_raw_message
if !block_given?
return @j_del.java_method(:getRawMessage, []).call() != nil ? JSON.parse(@j_del.java_method(:getRawMessage, []).call().encode) : nil
end
raise ArgumentError, "Invalid arguments when calling get_raw_message()"
end
|
- (self) set_raw_message(message = nil)
Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is
no message involved.
124
125
126
127
128
129
130
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 124
def set_raw_message(message=nil)
if message.class == Hash && !block_given?
@j_del.java_method(:setRawMessage, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(message))
return self
end
raise ArgumentError, "Invalid arguments when calling set_raw_message(#{message})"
end
|
- (true, false) try_complete?(result = nil)
Like
Vertx::Promise#complete but returns
false
when the promise is already completed instead of throwing
an IllegalStateException, it returns
true
otherwise.
68
69
70
71
72
73
74
75
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 68
def try_complete?(result=nil)
if !block_given? && result == nil
return @j_del.java_method(:tryComplete, []).call()
elsif (result.class == TrueClass || result.class == FalseClass) && !block_given?
return @j_del.java_method(:tryComplete, [Java::JavaLang::Boolean.java_class]).call(result)
end
raise ArgumentError, "Invalid arguments when calling try_complete?(#{result})"
end
|
- (true, false) tryFail(cause)
- (true, false) tryFail(message)
82
83
84
85
86
87
88
89
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 82
def try_fail?(param_1=nil)
if param_1.is_a?(Exception) && !block_given?
return @j_del.java_method(:tryFail, [Java::JavaLang::Throwable.java_class]).call(::Vertx::Util::Utils.to_throwable(param_1))
elsif param_1.class == String && !block_given?
return @j_del.java_method(:tryFail, [Java::java.lang.String.java_class]).call(param_1)
end
raise ArgumentError, "Invalid arguments when calling try_fail?(#{param_1})"
end
|
- (:SOCKET_CREATED, ...) type
Returns the type of the event
101
102
103
104
105
106
107
108
109
|
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-bridge-common/base_bridge_event.rb', line 101
def type
if !block_given?
if @cached_type != nil
return @cached_type
end
return @cached_type = @j_del.java_method(:type, []).call().name.intern
end
raise ArgumentError, "Invalid arguments when calling type()"
end
|