Interface JsonEvent
-
Method Details
-
type
JsonEventType type()- Returns:
- the type of the event
-
fieldName
String fieldName()- Returns:
- the name of the field when the event is emitted as a JSON object member
-
value
Object value()- Returns:
- the json value for
JsonEventType.VALUEevents
-
isNumber
boolean isNumber()- Returns:
- true when the JSON value is a number
-
integerValue
Integer integerValue()- Returns:
- the
Integervalue ornullif the event has no JSON value - Throws:
ClassCastException- if the value is not anInteger
-
longValue
Long longValue()- Returns:
- the
Longvalue ornullif the event has no JSON value - Throws:
ClassCastException- if the value is not aLong
-
floatValue
Float floatValue()- Returns:
- the
Floatvalue ornullif the event has no JSON value - Throws:
ClassCastException- if the value is not aFloat
-
doubleValue
Double doubleValue()- Returns:
- the
Doublevalue ornullif the event has no JSON value - Throws:
ClassCastException- if the value is not aDouble
-
isBoolean
boolean isBoolean()- Returns:
- true when the JSON value is a boolean
-
booleanValue
Boolean booleanValue()- Returns:
- the
Booleanvalue ornullif the event has no JSON value - Throws:
ClassCastException- if the value is not aBoolean
-
isString
boolean isString()- Returns:
- true when the JSON value is a string
-
stringValue
String stringValue()- Returns:
- the string value or
nullif the event has no JSON value - Throws:
ClassCastException- if the value is not a string
-
binaryValue
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.
- Returns:
- the binary value or
nullif the event has no JSON value - Throws:
ClassCastException- if the value is not a StringIllegalArgumentException- if the String value is not a legal Base64 encoded value
-
instantValue
Instant instantValue()Return theInstantvalue.JSON itself has no notion of a temporal types, this extension complies to the RFC-7493, so this method assumes there is a String value with the key and it contains an ISO 8601 encoded date and time format such as "2017-04-03T10:25:41Z", which it decodes if found and returns.
- Returns:
- the
Instantvalue ornullif the event has no JSON value - Throws:
ClassCastException- if the value is not a StringDateTimeParseException- if the String value is not a legal ISO 8601 encoded value
-
isNull
boolean isNull()- Returns:
- true when the JSON value is null
-
isObject
boolean isObject()- Returns:
- true when the JSON value is a JSON object
-
objectValue
JsonObject objectValue()- Returns:
- the JSON object value or
nullif the event has no JSON value - Throws:
ClassCastException- if the value is not a JSON object
-
isArray
boolean isArray()- Returns:
- true when the JSON value is a JSON array
-
arrayValue
JsonArray arrayValue()- Returns:
- the JSON array value or
nullif the event has no JSON value - Throws:
ClassCastException- if the value is not a JSON array
-
mapTo
Decodes and returns the current value as the specifiedtype.- Parameters:
type- the type to decode the value to- Returns:
- the decoded value
-