@NotExtensible @NotMutable @ThreadSafety(level=INTERFACE_THREADSAFE) public class TextFormattedLogMessage 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 and Type | Field and Description |
---|---|
protected static java.lang.String |
NO_FIELD_NAME
A predefined string that will be used if a field exists in a log message
with just a value but no field name.
|
Modifier | Constructor and Description |
---|---|
|
TextFormattedLogMessage(java.lang.String logMessageString)
Creates a new text-formatted log message from the provided string.
|
protected |
TextFormattedLogMessage(TextFormattedLogMessage message)
Creates a new text-formatted log message from the provided parsed message.
|
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. |
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.
|
@NotNull protected static final java.lang.String NO_FIELD_NAME
protected TextFormattedLogMessage(@NotNull TextFormattedLogMessage message)
message
- The message to use to create this log message. It must
not be null
.public TextFormattedLogMessage(@NotNull java.lang.String logMessageString) throws LogException
logMessageString
- The string representation of this log message.
It must not be null
.LogException
- If the provided string cannot be parsed as a valid
text-formatted log message.@NotNull public final java.util.Date getTimestamp()
getTimestamp
in interface LogMessage
@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