Class JSONLogMessage
- java.lang.Object
-
- com.unboundid.ldap.sdk.unboundidds.logs.v2.json.JSONLogMessage
-
- All Implemented Interfaces:
LogMessage,java.io.Serializable
- Direct Known Subclasses:
JSONAccessLogMessage
@NotExtensible @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class JSONLogMessage extends java.lang.Object implements LogMessage
This class provides a data structure that holds information about a JSON-formatted log message.
NOTE: This class, and other classes within the
com.unboundid.ldap.sdk.unboundiddspackage 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.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJSONLogMessage(JSONObject jsonObject)Creates a new JSON log message from the provided JSON object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.BooleangetBoolean(LogField logField)Retrieves the value of the specified field as aBooleanobject.java.lang.DoublegetDouble(LogField logField)Retrieves the value of the specified field as aDoublevalue.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.DategetGeneralizedTime(LogField logField)Retrieves the value of the specified field as aDateobject decoded from the generalized time format.java.lang.IntegergetInteger(LogField logField)Retrieves the value of the specified field as anIntegervalue.JSONObjectgetJSONObject()Retrieves the JSON object that contains an encoded representation of this log message.java.lang.StringgetLogType()Retrieves the type of logger with which this message is associated.java.lang.LonggetLong(LogField logField)Retrieves the value of the specified field as aLongvalue.java.util.DategetRFC3339Timestamp(LogField logField)Retrieves the value of the specified field as aDateobject decoded from the ISO 8601 format described in RFC 3339.java.lang.StringgetString(LogField logField)Retrieves the value of the specified field as a string.java.util.DategetTimestamp()Retrieves the timestamp for this log message.java.lang.StringtoString()Retrieves a string representation of this log message.
-
-
-
Constructor Detail
-
JSONLogMessage
protected JSONLogMessage(@NotNull JSONObject jsonObject) throws LogException
Creates a new JSON log message from the provided JSON object.- Parameters:
jsonObject- The JSON object that contains an encoded representation of this log message. It must not benull.- Throws:
LogException- If the provided JSON object cannot be parsed as a valid log message.
-
-
Method Detail
-
getJSONObject
@NotNull public final JSONObject getJSONObject()
Retrieves the JSON object that contains an encoded representation of this log message.- Returns:
- The JSON object that contains an encoded representation of this log message.
-
getTimestamp
@NotNull public final java.util.Date getTimestamp()
Retrieves the timestamp for this log message.- Specified by:
getTimestampin interfaceLogMessage- Returns:
- The timestamp for this log message.
-
getLogType
@Nullable public final java.lang.String getLogType()
Retrieves the type of logger with which this message is associated.- Returns:
- The type of logger with which this message is associated, or
nullif it is not included in the log message.
-
getFields
@NotNull public final 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.- Specified by:
getFieldsin interfaceLogMessage- Returns:
- A map of the fields and their corresponding values in this log message.
-
getBoolean
@Nullable public final java.lang.Boolean getBoolean(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aBooleanobject. If the field has multiple values, the first will be returned.- Specified by:
getBooleanin interfaceLogMessage- Parameters:
logField- The field for which to retrieve the Boolean value.- Returns:
- The value of the specified field as a
Booleanobject, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as a Boolean.
-
getGeneralizedTime
@Nullable public final java.util.Date getGeneralizedTime(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aDateobject decoded from the generalized time format. If the field has multiple values, the first will be returned.- Specified by:
getGeneralizedTimein interfaceLogMessage- Parameters:
logField- The field for which to retrieve the timestamp value.- Returns:
- The value of the specified field as a
Dateobject, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as aDatein the generalized time format.
-
getDouble
@Nullable public final java.lang.Double getDouble(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aDoublevalue. If the field has multiple values, the first will be returned.- Specified by:
getDoublein interfaceLogMessage- Parameters:
logField- The field for which to retrieve theDoublevalue.- Returns:
- The value of the specified field as a
Doublevalue, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as aDouble.
-
getInteger
@Nullable public final java.lang.Integer getInteger(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as anIntegervalue. If the field has multiple values, the first will be returned.- Specified by:
getIntegerin interfaceLogMessage- Parameters:
logField- The field for which to retrieve theIntegervalue.- Returns:
- The
Integervalue of the specified field, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as anInteger.
-
getLong
@Nullable public final java.lang.Long getLong(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aLongvalue. If the field has multiple values, the first will be returned.- Specified by:
getLongin interfaceLogMessage- Parameters:
logField- The field for which to retrieve theLongvalue.- Returns:
- The
Longvalue of the specified field, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as aLong.
-
getRFC3339Timestamp
@Nullable public final java.util.Date getRFC3339Timestamp(@NotNull LogField logField) throws LogException
Retrieves the value of the specified field as aDateobject decoded from the ISO 8601 format described in RFC 3339. If the field has multiple values, the first will be returned.- Specified by:
getRFC3339Timestampin interfaceLogMessage- Parameters:
logField- The field for which to retrieve the timestamp value.- Returns:
- The value of the specified field as a
Dateobject, ornullif the log message does not have the specified field. - Throws:
LogException- If the value of the specified field cannot be parsed as aDatein the RFC 3339 format.
-
getString
@Nullable public final java.lang.String getString(@NotNull LogField logField)
Retrieves the value of the specified field as a string. If the field has multiple values, the first will be returned.- Specified by:
getStringin interfaceLogMessage- Parameters:
logField- The field for which to retrieve the string value.- Returns:
- The value of the specified field as a string, or
nullif the log message does not have the specified field.
-
toString
@NotNull public final java.lang.String toString()
Retrieves a string representation of this log message.- Specified by:
toStringin interfaceLogMessage- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of this log message.
-
-