@NotExtensible @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class JSONLogMessage extends java.lang.Object implements LogMessage
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundidds
package structure, are only
supported for use against Ping Identity, UnboundID, and
Nokia/Alcatel-Lucent 8661 server products. These classes provide support
for proprietary functionality or for external specifications that are not
considered stable or mature enough to be guaranteed to work in an
interoperable way with other types of LDAP servers.
Modifier | Constructor and Description |
---|---|
protected |
JSONLogMessage(JSONObject jsonObject)
Creates a new JSON log message from the provided JSON object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
getBoolean(LogField logField)
Retrieves the value of the specified field as a
Boolean object. |
java.lang.Double |
getDouble(LogField logField)
Retrieves the value of the specified field as a
Double value. |
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getFields()
Retrieves a map of the fields and their corresponding values in this
log message.
|
java.util.Date |
getGeneralizedTime(LogField logField)
Retrieves the value of the specified field as a
Date object decoded
from the generalized time format. |
java.lang.Integer |
getInteger(LogField logField)
Retrieves the value of the specified field as an
Integer value. |
JSONObject |
getJSONObject()
Retrieves the JSON object that contains an encoded representation of this
log message.
|
java.lang.String |
getLogType()
Retrieves the type of logger with which this message is associated.
|
java.lang.Long |
getLong(LogField logField)
Retrieves the value of the specified field as a
Long value. |
java.util.Date |
getRFC3339Timestamp(LogField logField)
Retrieves the value of the specified field as a
Date object decoded
from the ISO 8601 format described in RFC 3339. |
java.lang.String |
getString(LogField logField)
Retrieves the value of the specified field as a string.
|
java.util.Date |
getTimestamp()
Retrieves the timestamp for this log message.
|
java.lang.String |
toString()
Retrieves a string representation of this log message.
|
protected JSONLogMessage(@NotNull JSONObject jsonObject) throws LogException
jsonObject
- The JSON object that contains an encoded representation
of this log message. It must not be null
.LogException
- If the provided JSON object cannot be parsed as a
valid log message.@NotNull public final JSONObject getJSONObject()
@NotNull public final java.util.Date getTimestamp()
getTimestamp
in interface LogMessage
@Nullable public final java.lang.String getLogType()
null
if it is not included in the log message.@NotNull public final java.util.Map<java.lang.String,java.util.List<java.lang.String>> getFields()
getFields
in interface LogMessage
@Nullable public final java.lang.Boolean getBoolean(@NotNull LogField logField) throws LogException
Boolean
object. If
the field has multiple values, the first will be returned.getBoolean
in interface LogMessage
logField
- The field for which to retrieve the Boolean value.Boolean
object, or
null
if the log message does not have the specified field.LogException
- If the value of the specified field cannot be parsed
as a Boolean.@Nullable public final java.util.Date getGeneralizedTime(@NotNull LogField logField) throws LogException
Date
object decoded
from the generalized time format. If the field has multiple values, the
first will be returned.getGeneralizedTime
in interface LogMessage
logField
- The field for which to retrieve the timestamp value.Date
object, or
null
if the log message does not have the specified field.LogException
- If the value of the specified field cannot be parsed
as a Date
in the generalized time format.@Nullable public final java.lang.Double getDouble(@NotNull LogField logField) throws LogException
Double
value. If
the field has multiple values, the first will be returned.getDouble
in interface LogMessage
logField
- The field for which to retrieve the Double
value.Double
value, or
null
if the log message does not have the specified field.LogException
- If the value of the specified field cannot be parsed
as a Double
.@Nullable public final java.lang.Integer getInteger(@NotNull LogField logField) throws LogException
Integer
value. If
the field has multiple values, the first will be returned.getInteger
in interface LogMessage
logField
- The field for which to retrieve the Integer
value.Integer
value of the specified field, or null
if the log message does not have the specified field.LogException
- If the value of the specified field cannot be parsed
as an Integer
.@Nullable public final java.lang.Long getLong(@NotNull LogField logField) throws LogException
Long
value. If the
field has multiple values, the first will be returned.getLong
in interface LogMessage
logField
- The field for which to retrieve the Long
value.Long
value of the specified field, or null
if the log message does not have the specified field.LogException
- If the value of the specified field cannot be parsed
as a Long
.@Nullable public final java.util.Date getRFC3339Timestamp(@NotNull LogField logField) throws LogException
Date
object decoded
from the ISO 8601 format described in RFC 3339. If the field has multiple
values, the first will be returned.getRFC3339Timestamp
in interface LogMessage
logField
- The field for which to retrieve the timestamp value.Date
object, or
null
if the log message does not have the specified field.LogException
- If the value of the specified field cannot be parsed
as a Date
in the RFC 3339 format.@Nullable public final java.lang.String getString(@NotNull LogField logField)
getString
in interface LogMessage
logField
- The field for which to retrieve the string value.null
if
the log message does not have the specified field.@NotNull public final java.lang.String toString()
toString
in interface LogMessage
toString
in class java.lang.Object