Class: Vertx::JsonEvent
- Inherits:
-
Object
- Object
- Vertx::JsonEvent
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb
Overview
A JSON event emited by the JsonParser.
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)
-
- (true, false) isArray
True when the JSON value is a JSON array.
-
- (Array<String,Object>) arrayValue
The JSON array value or null if the event has no JSON value.
-
- (::Vertx::Buffer) binaryValue
Return the binary value.
-
- (true, false) isBoolean
True when the JSON value is a boolean.
-
- (true, false) booleanValue
The Boolean value or null if the event has no JSON value.
-
- (Float) doubleValue
The Double value or null if the event has no JSON value.
-
- (String) fieldName
The name of the field when the event is emitted as a JSON object member.
-
- (Float) floatValue
The Float value or null if the event has no JSON value.
-
- (Fixnum) integerValue
The Integer value or null if the event has no JSON value.
-
- (Fixnum) longValue
The Long value or null if the event has no JSON value.
-
- (Object) mapTo(type)
Decodes and returns the current value as the specified type.
-
- (true, false) isNull
True when the JSON value is null.
-
- (true, false) isNumber
True when the JSON value is a number.
-
- (true, false) isObject
True when the JSON value is a JSON object.
-
- (Hash{String => Object}) objectValue
The JSON object value or null if the event has no JSON value.
-
- (true, false) isString
True when the JSON value is a string.
-
- (String) stringValue
The string value or null if the event has no JSON value.
-
- (:START_OBJECT, ...) type
The type of the event.
-
- (Object) value
The json value for events.
Class Method Details
+ (Boolean) accept?(obj)
19 20 21 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 19 def @@j_api_type.accept?(obj) obj.class == JsonEvent end |
+ (Object) j_api_type
28 29 30 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 28 def self.j_api_type @@j_api_type end |
+ (Object) j_class
31 32 33 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 31 def self.j_class Java::IoVertxCoreParsetools::JsonEvent.java_class end |
+ (Object) unwrap(obj)
25 26 27 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 25 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
22 23 24 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 22 def @@j_api_type.wrap(obj) JsonEvent.new(obj) end |
Instance Method Details
- (true, false) isArray
Returns true when the JSON value is a JSON array
206 207 208 209 210 211 212 213 214 215 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 206 def array? if !block_given? return @j_del.java_method(:isArray, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling array?()" end end |
- (Array<String,Object>) arrayValue
Returns the JSON array value or
null
if the event has no JSON value
84 85 86 87 88 89 90 91 92 93 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 84 def array_value if !block_given? return @j_del.java_method(:arrayValue, []).call() != nil ? JSON.parse(@j_del.java_method(:arrayValue, []).call().encode) : nil end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling array_value()" end end |
- (::Vertx::Buffer) binaryValue
Return the binary value.
JSON itself has no notion of a binary, this extension complies to the RFC-7493, so this method assumes there is a String value with the key and it contains a Base64 encoded binary, which it decodes if found and returns.
258 259 260 261 262 263 264 265 266 267 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 258 def binary_value if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:binaryValue, []).call(),::Vertx::Buffer) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling binary_value()" end end |
- (true, false) isBoolean
Returns true when the JSON value is a boolean
144 145 146 147 148 149 150 151 152 153 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 144 def boolean? if !block_given? return @j_del.java_method(:isBoolean, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling boolean?()" end end |
- (true, false) booleanValue
Returns the
Boolean
value or null
if the event has no JSON value
218 219 220 221 222 223 224 225 226 227 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 218 def boolean_value? if !block_given? return @j_del.java_method(:booleanValue, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling boolean_value?()" end end |
- (Float) doubleValue
Returns the
Double
value or null
if the event has no JSON value
96 97 98 99 100 101 102 103 104 105 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 96 def double_value if !block_given? return @j_del.java_method(:doubleValue, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling double_value()" end end |
- (String) fieldName
Returns the name of the field when the event is emitted as a JSON object member
36 37 38 39 40 41 42 43 44 45 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 36 def field_name if !block_given? return @j_del.java_method(:fieldName, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling field_name()" end end |
- (Float) floatValue
Returns the
Float
value or null
if the event has no JSON value
60 61 62 63 64 65 66 67 68 69 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 60 def float_value if !block_given? return @j_del.java_method(:floatValue, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling float_value()" end end |
- (Fixnum) integerValue
Returns the
Integer
value or null
if the event has no JSON value
230 231 232 233 234 235 236 237 238 239 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 230 def integer_value if !block_given? return @j_del.java_method(:integerValue, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling integer_value()" end end |
- (Fixnum) longValue
Returns the
Long
value or null
if the event has no JSON value
120 121 122 123 124 125 126 127 128 129 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 120 def long_value if !block_given? return @j_del.java_method(:longValue, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling long_value()" end end |
- (Object) mapTo(type)
Decodes and returns the current value as the specified
type
.
194 195 196 197 198 199 200 201 202 203 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 194 def map_to(*args) if args[0].class == Class && !block_given? return ::Vertx::Util::Utils.v_type_of(args[0]).wrap(@j_del.java_method(:mapTo, [Java::JavaLang::Class.java_class]).call(::Vertx::Util::Utils.j_class_of(args[0]))) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling map_to(#{args[0]})" end end |
- (true, false) isNull
Returns true when the JSON value is null
168 169 170 171 172 173 174 175 176 177 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 168 def null? if !block_given? return @j_del.java_method(:isNull, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling null?()" end end |
- (true, false) isNumber
Returns true when the JSON value is a number
156 157 158 159 160 161 162 163 164 165 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 156 def number? if !block_given? return @j_del.java_method(:isNumber, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling number?()" end end |
- (true, false) isObject
Returns true when the JSON value is a JSON object
48 49 50 51 52 53 54 55 56 57 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 48 def object? if !block_given? return @j_del.java_method(:isObject, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling object?()" end end |
- (Hash{String => Object}) objectValue
Returns the JSON object value or
null
if the event has no JSON value
72 73 74 75 76 77 78 79 80 81 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 72 def object_value if !block_given? return @j_del.java_method(:objectValue, []).call() != nil ? JSON.parse(@j_del.java_method(:objectValue, []).call().encode) : nil end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling object_value()" end end |
- (true, false) isString
Returns true when the JSON value is a string
180 181 182 183 184 185 186 187 188 189 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 180 def string? if !block_given? return @j_del.java_method(:isString, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling string?()" end end |
- (String) stringValue
Returns the string value or
null
if the event has no JSON value
132 133 134 135 136 137 138 139 140 141 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 132 def string_value if !block_given? return @j_del.java_method(:stringValue, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling string_value()" end end |
- (:START_OBJECT, ...) type
Returns the type of the event
108 109 110 111 112 113 114 115 116 117 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 108 def type if !block_given? return @j_del.java_method(:type, []).call().name.intern end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling type()" end end |
- (Object) value
Returns the json value for events
242 243 244 245 246 247 248 249 250 251 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 242 def value if !block_given? return ::Vertx::Util::Utils.from_object(@j_del.java_method(:value, []).call()) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling value()" end end |