Class: Vertx::JsonEvent

Inherits:
Object
  • Object
show all
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)

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/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

Returns:

  • (true, false)
    true when the JSON value is a JSON array

Raises:

  • (ArgumentError)


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

Returns:

  • (Array<String,Object>)
    the JSON array value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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.

Returns:

  • (::Vertx::Buffer)
    the binary value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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

Returns:

  • (true, false)
    true when the JSON value is a boolean

Raises:

  • (ArgumentError)


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

Returns:

  • (true, false)
    the Boolean value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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

Returns:

  • (Float)
    the Double value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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

Returns:

  • (String)
    the name of the field when the event is emitted as a JSON object member

Raises:

  • (ArgumentError)


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

Returns:

  • (Float)
    the Float value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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

Returns:

  • (Fixnum)
    the Integer value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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

Returns:

  • (Fixnum)
    the Long value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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.

Parameters:

  • type (Nil) (defaults to: nil)
    the type to decode the value to

Returns:

  • (Object)
    the decoded value

Raises:

  • (ArgumentError)


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

Returns:

  • (true, false)
    true when the JSON value is null

Raises:

  • (ArgumentError)


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

Returns:

  • (true, false)
    true when the JSON value is a number

Raises:

  • (ArgumentError)


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

Returns:

  • (true, false)
    true when the JSON value is a JSON object

Raises:

  • (ArgumentError)


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

Returns:

  • (Hash{String => Object})
    the JSON object value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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

Returns:

  • (true, false)
    true when the JSON value is a string

Raises:

  • (ArgumentError)


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

Returns:

  • (String)
    the string value or null if the event has no JSON value

Raises:

  • (ArgumentError)


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

Returns:

  • (:START_OBJECT, :END_OBJECT, :START_ARRAY, :END_ARRAY, :VALUE)
    the type of the event

Raises:

  • (ArgumentError)


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

Returns:

  • (Object)
    the json value for events

Raises:

  • (ArgumentError)


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