Package org.apache.logging.log4j.message
Class StructuredDataId
java.lang.Object
org.apache.logging.log4j.message.StructuredDataId
- All Implemented Interfaces:
Serializable
,StringBuilderFormattable
The StructuredData identifier.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final StructuredDataId
RFC 5424 Meta.static final StructuredDataId
RFC 5424 Origin.static final String
Reserved enterprise number.static final StructuredDataId
RFC 5424 Time Quality. -
Constructor Summary
ConstructorDescriptionStructuredDataId
(String name) Creates a StructuredDataId based on the name.StructuredDataId
(String name, int maxLength) Creates a StructuredDataId based on the name.StructuredDataId
(String name, int enterpriseNumber, String[] required, String[] optional) Deprecated.StructuredDataId
(String name, int enterpriseNumber, String[] required, String[] optional, int maxLength) Deprecated.Since 2.18.0, useStructuredDataId(String, String, String[], String[], int)
instead.StructuredDataId
(String name, String[] required, String[] optional) StructuredDataId
(String name, String[] required, String[] optional, int maxLength) A Constructor that helps conformance to RFC 5424.StructuredDataId
(String name, String enterpriseNumber, String[] required, String[] optional) A Constructor that helps conformance to RFC 5424.StructuredDataId
(String name, String enterpriseNumber, String[] required, String[] optional, int maxLength) A Constructor that helps conformance to RFC 5424. -
Method Summary
Modifier and TypeMethodDescriptionvoid
formatTo
(StringBuilder buffer) Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.Returns the enterprise number.getName()
Returns the StructuredDataId name.String[]
Returns a list of optional keys.String[]
Returns a list of required keys.boolean
Indicates if the id is reserved.final StructuredDataId
Deprecated.Since 2.18.0, usemakeId(String, String)
insteadCreates an id based on the current id.Creates an id using another id to supply default values.toString()
-
Field Details
-
TIME_QUALITY
RFC 5424 Time Quality. -
ORIGIN
RFC 5424 Origin. -
META
RFC 5424 Meta. -
RESERVED
Reserved enterprise number.- Since:
- 2.18.0
- See Also:
-
-
Constructor Details
-
StructuredDataId
Creates a StructuredDataId based on the name.- Parameters:
name
- The Structured Data Element name (maximum length is 32)- Since:
- 2.9.0
-
StructuredDataId
Creates a StructuredDataId based on the name.- Parameters:
name
- The Structured Data Element name.maxLength
- The maximum length of the name.- Since:
- 2.9.0
-
StructuredDataId
- Parameters:
name
- The name portion of the id.required
- The list of keys that are required for this id.optional
- The list of keys that are optional for this id.
-
StructuredDataId
A Constructor that helps conformance to RFC 5424.- Parameters:
name
- The name portion of the id.required
- The list of keys that are required for this id.optional
- The list of keys that are optional for this id.maxLength
- The maximum length of the id's name.- Since:
- 2.9.0
-
StructuredDataId
A Constructor that helps conformance to RFC 5424.- Parameters:
name
- The name portion of the id.enterpriseNumber
- The enterprise number.required
- The list of keys that are required for this id.optional
- The list of keys that are optional for this id.- Since:
- 2.18.0
-
StructuredDataId
@Deprecated @InlineMe(replacement="this(name, String.valueOf(enterpriseNumber), required, optional)") public StructuredDataId(String name, int enterpriseNumber, String[] required, String[] optional) Deprecated.Since 2.18.0, useStructuredDataId(String, String, String[], String[])
instead.A Constructor that helps conformance to RFC 5424.- Parameters:
name
- The name portion of the id.enterpriseNumber
- The enterprise number.required
- The list of keys that are required for this id.optional
- The list of keys that are optional for this id.
-
StructuredDataId
public StructuredDataId(String name, String enterpriseNumber, String[] required, String[] optional, int maxLength) A Constructor that helps conformance to RFC 5424.- Parameters:
name
- The name portion of the id.enterpriseNumber
- The enterprise number.required
- The list of keys that are required for this id.optional
- The list of keys that are optional for this id.maxLength
- The maximum length of the StructuredData Id key.- Since:
- 2.18.0
-
StructuredDataId
@InlineMe(replacement="this(name, String.valueOf(enterpriseNumber), required, optional, maxLength)") @Deprecated public StructuredDataId(String name, int enterpriseNumber, String[] required, String[] optional, int maxLength) Deprecated.Since 2.18.0, useStructuredDataId(String, String, String[], String[], int)
instead.A Constructor that helps conformance to RFC 5424.- Parameters:
name
- The name portion of the id.enterpriseNumber
- The enterprise number.required
- The list of keys that are required for this id.optional
- The list of keys that are optional for this id.maxLength
- The maximum length of the StructuredData Id key.- Since:
- 2.9.0
-
-
Method Details
-
makeId
Creates an id using another id to supply default values.- Parameters:
id
- The original StructuredDataId.- Returns:
- the new StructuredDataId.
-
makeId
Creates an id based on the current id.- Parameters:
defaultId
- The default id to use if this StructuredDataId doesn't have a name.anEnterpriseNumber
- The enterprise number.- Returns:
- a StructuredDataId.
- Since:
- 2.18.0
-
makeId
@Deprecated @InlineMe(replacement="this.makeId(defaultId, String.valueOf(anEnterpriseNumber))") public final StructuredDataId makeId(String defaultId, int anEnterpriseNumber) Deprecated.Since 2.18.0, usemakeId(String, String)
insteadCreates an id based on the current id.- Parameters:
defaultId
- The default id to use if this StructuredDataId doesn't have a name.anEnterpriseNumber
- The enterprise number.- Returns:
- a StructuredDataId.
-
getRequired
Returns a list of required keys.- Returns:
- a List of required keys or null if none have been provided.
-
getOptional
Returns a list of optional keys.- Returns:
- a List of optional keys or null if none have been provided.
-
getName
Returns the StructuredDataId name.- Returns:
- the StructuredDataId name.
-
getEnterpriseNumber
Returns the enterprise number.- Returns:
- the enterprise number.
- Since:
- 2.18.0
-
isReserved
public boolean isReserved()Indicates if the id is reserved.- Returns:
- true if the id uses the reserved enterprise number, false otherwise.
-
toString
-
formatTo
Description copied from interface:StringBuilderFormattable
Writes a text representation of this object into the specifiedStringBuilder
, ideally without allocating temporary objects.- Specified by:
formatTo
in interfaceStringBuilderFormattable
- Parameters:
buffer
- the StringBuilder to write into
-
StructuredDataId(String, String, String[], String[])
instead.