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) array?
True when the JSON value is a JSON array.
-
- (Array<String,Object>) array_value
The JSON array value or null if the event has no JSON value.
-
- (::Vertx::Buffer) binary_value
Return the binary value.
-
- (true, false) boolean?
True when the JSON value is a boolean.
-
- (true, false) boolean_value?
The Boolean value or null if the event has no JSON value.
-
- (Float) double_value
The Double value or null if the event has no JSON value.
-
- (String) field_name
The name of the field when the event is emitted as a JSON object member.
-
- (Float) float_value
The Float value or null if the event has no JSON value.
-
- (Fixnum) integer_value
The Integer value or null if the event has no JSON value.
-
- (Fixnum) long_value
The Long value or null if the event has no JSON value.
-
- (Object) map_to(type = nil)
Decodes and returns the current value as the specified type.
-
- (true, false) null?
True when the JSON value is null.
-
- (true, false) number?
True when the JSON value is a number.
-
- (true, false) object?
True when the JSON value is a JSON object.
-
- (Hash{String => Object}) object_value
The JSON object value or null if the event has no JSON value.
-
- (true, false) string?
True when the JSON value is a string.
-
- (String) string_value
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)
18 19 20 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 18 def @@j_api_type.accept?(obj) obj.class == JsonEvent end |
+ (Object) j_api_type
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.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/json_event.rb', line 30 def self.j_class Java::IoVertxCoreParsetools::JsonEvent.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/json_event.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/json_event.rb', line 21 def @@j_api_type.wrap(obj) JsonEvent.new(obj) end |
Instance Method Details
- (true, false) array?
Returns true when the JSON value is a JSON array
150 151 152 153 154 155 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 150 def array? if !block_given? return @j_del.java_method(:isArray, []).call() end raise ArgumentError, "Invalid arguments when calling array?()" end |
- (Array<String,Object>) array_value
Returns the JSON array value or
null
if the event has no JSON value
157 158 159 160 161 162 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 157 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 raise ArgumentError, "Invalid arguments when calling array_value()" end |
- (::Vertx::Buffer) binary_value
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.
122 123 124 125 126 127 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 122 def binary_value if !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:binaryValue, []).call(),::Vertx::Buffer) end raise ArgumentError, "Invalid arguments when calling binary_value()" end |
- (true, false) boolean?
Returns true when the JSON value is a boolean
90 91 92 93 94 95 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 90 def boolean? if !block_given? return @j_del.java_method(:isBoolean, []).call() end raise ArgumentError, "Invalid arguments when calling boolean?()" end |
- (true, false) boolean_value?
Returns the
Boolean
value or null
if the event has no JSON value
97 98 99 100 101 102 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 97 def boolean_value? if !block_given? return @j_del.java_method(:booleanValue, []).call() end raise ArgumentError, "Invalid arguments when calling boolean_value?()" end |
- (Float) double_value
Returns the
Double
value or null
if the event has no JSON value
83 84 85 86 87 88 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 83 def double_value if !block_given? return @j_del.java_method(:doubleValue, []).call() end raise ArgumentError, "Invalid arguments when calling double_value()" end |
- (String) field_name
Returns the name of the field when the event is emitted as a JSON object member
41 42 43 44 45 46 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 41 def field_name if !block_given? return @j_del.java_method(:fieldName, []).call() end raise ArgumentError, "Invalid arguments when calling field_name()" end |
- (Float) float_value
Returns the
Float
value or null
if the event has no JSON value
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 76 def float_value if !block_given? return @j_del.java_method(:floatValue, []).call() end raise ArgumentError, "Invalid arguments when calling float_value()" end |
- (Fixnum) integer_value
Returns the
Integer
value or null
if the event has no JSON value
62 63 64 65 66 67 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 62 def integer_value if !block_given? return @j_del.java_method(:integerValue, []).call() end raise ArgumentError, "Invalid arguments when calling integer_value()" end |
- (Fixnum) long_value
Returns the
Long
value or null
if the event has no JSON value
69 70 71 72 73 74 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 69 def long_value if !block_given? return @j_del.java_method(:longValue, []).call() end raise ArgumentError, "Invalid arguments when calling long_value()" end |
- (Object) map_to(type = nil)
Decodes and returns the current value as the specified
type
.
166 167 168 169 170 171 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 166 def map_to(type=nil) if type.class == Class && !block_given? return ::Vertx::Util::Utils.v_type_of(type).wrap(@j_del.java_method(:mapTo, [Java::JavaLang::Class.java_class]).call(::Vertx::Util::Utils.j_class_of(type))) end raise ArgumentError, "Invalid arguments when calling map_to(#{type})" end |
- (true, false) null?
Returns true when the JSON value is null
129 130 131 132 133 134 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 129 def null? if !block_given? return @j_del.java_method(:isNull, []).call() end raise ArgumentError, "Invalid arguments when calling null?()" end |
- (true, false) number?
Returns true when the JSON value is a number
55 56 57 58 59 60 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 55 def number? if !block_given? return @j_del.java_method(:isNumber, []).call() end raise ArgumentError, "Invalid arguments when calling number?()" end |
- (true, false) object?
Returns true when the JSON value is a JSON object
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 136 def object? if !block_given? return @j_del.java_method(:isObject, []).call() end raise ArgumentError, "Invalid arguments when calling object?()" end |
- (Hash{String => Object}) object_value
Returns the JSON object value or
null
if the event has no JSON value
143 144 145 146 147 148 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 143 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 raise ArgumentError, "Invalid arguments when calling object_value()" end |
- (true, false) string?
Returns true when the JSON value is a string
104 105 106 107 108 109 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 104 def string? if !block_given? return @j_del.java_method(:isString, []).call() end raise ArgumentError, "Invalid arguments when calling string?()" end |
- (String) string_value
Returns the string value or
null
if the event has no JSON value
111 112 113 114 115 116 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 111 def string_value if !block_given? return @j_del.java_method(:stringValue, []).call() end raise ArgumentError, "Invalid arguments when calling string_value()" end |
- (:START_OBJECT, ...) type
Returns the type of the event
34 35 36 37 38 39 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 34 def type if !block_given? return @j_del.java_method(:type, []).call().name.intern end raise ArgumentError, "Invalid arguments when calling type()" end |
- (Object) value
Returns the json value for events
48 49 50 51 52 53 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/json_event.rb', line 48 def value if !block_given? return ::Vertx::Util::Utils.from_object(@j_del.java_method(:value, []).call()) end raise ArgumentError, "Invalid arguments when calling value()" end |