Package org.apache.logging.log4j.message
Class StructuredDataId
- java.lang.Object
-
- org.apache.logging.log4j.message.StructuredDataId
-
- All Implemented Interfaces:
java.io.Serializable
,org.apache.logging.log4j.util.StringBuilderFormattable
public class StructuredDataId extends java.lang.Object implements java.io.Serializable, org.apache.logging.log4j.util.StringBuilderFormattable
The StructuredData identifier.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StructuredDataId
META
RFC 5424 Meta.static StructuredDataId
ORIGIN
RFC 5424 Origin.static java.lang.String
RESERVED
Reserved enterprise number.static StructuredDataId
TIME_QUALITY
RFC 5424 Time Quality.
-
Constructor Summary
Constructors Constructor Description StructuredDataId(java.lang.String name)
Creates a StructuredDataId based on the name.StructuredDataId(java.lang.String name, int maxLength)
Creates a StructuredDataId based on the name.StructuredDataId(java.lang.String name, int enterpriseNumber, java.lang.String[] required, java.lang.String[] optional)
Deprecated.UseStructuredDataId(String, String, String[], String[])
instead.StructuredDataId(java.lang.String name, int enterpriseNumber, java.lang.String[] required, java.lang.String[] optional, int maxLength)
Deprecated.StructuredDataId(java.lang.String name, java.lang.String[] required, java.lang.String[] optional)
StructuredDataId(java.lang.String name, java.lang.String[] required, java.lang.String[] optional, int maxLength)
A Constructor that helps conformance to RFC 5424.StructuredDataId(java.lang.String name, java.lang.String enterpriseNumber, java.lang.String[] required, java.lang.String[] optional)
A Constructor that helps conformance to RFC 5424.StructuredDataId(java.lang.String name, java.lang.String enterpriseNumber, java.lang.String[] required, java.lang.String[] optional, int maxLength)
A Constructor that helps conformance to RFC 5424.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
formatTo(java.lang.StringBuilder buffer)
java.lang.String
getEnterpriseNumber()
Returns the enterprise number.java.lang.String
getName()
Returns the StructuredDataId name.java.lang.String[]
getOptional()
Returns a list of optional keys.java.lang.String[]
getRequired()
Returns a list of required keys.boolean
isReserved()
Indicates if the id is reserved.StructuredDataId
makeId(java.lang.String defaultId, int anEnterpriseNumber)
Deprecated.UsemakeId(String, String)
insteadStructuredDataId
makeId(java.lang.String defaultId, java.lang.String anEnterpriseNumber)
Creates an id based on the current id.StructuredDataId
makeId(StructuredDataId id)
Creates an id using another id to supply default values.java.lang.String
toString()
-
-
-
Field Detail
-
TIME_QUALITY
public static final StructuredDataId TIME_QUALITY
RFC 5424 Time Quality.
-
ORIGIN
public static final StructuredDataId ORIGIN
RFC 5424 Origin.
-
META
public static final StructuredDataId META
RFC 5424 Meta.
-
RESERVED
public static final java.lang.String RESERVED
Reserved enterprise number.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StructuredDataId
public StructuredDataId(java.lang.String name)
Creates a StructuredDataId based on the name.- Parameters:
name
- The Structured Data Element name (maximum length is 32)- Since:
- 2.9
-
StructuredDataId
public StructuredDataId(java.lang.String name, int maxLength)
Creates a StructuredDataId based on the name.- Parameters:
name
- The Structured Data Element name.maxLength
- The maximum length of the name.- Since:
- 2.9
-
StructuredDataId
public StructuredDataId(java.lang.String name, java.lang.String[] required, java.lang.String[] optional)
- Parameters:
name
-required
-optional
-
-
StructuredDataId
public StructuredDataId(java.lang.String name, java.lang.String[] required, java.lang.String[] optional, int maxLength)
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.- Since:
- 2.9
-
StructuredDataId
public StructuredDataId(java.lang.String name, java.lang.String enterpriseNumber, java.lang.String[] required, java.lang.String[] optional)
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
@Deprecated public StructuredDataId(java.lang.String name, int enterpriseNumber, java.lang.String[] required, java.lang.String[] optional)
Deprecated.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(java.lang.String name, java.lang.String enterpriseNumber, java.lang.String[] required, java.lang.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.9
-
StructuredDataId
@Deprecated public StructuredDataId(java.lang.String name, int enterpriseNumber, java.lang.String[] required, java.lang.String[] optional, int maxLength)
Deprecated.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
-
-
Method Detail
-
makeId
public StructuredDataId makeId(StructuredDataId id)
Creates an id using another id to supply default values.- Parameters:
id
- The original StructuredDataId.- Returns:
- the new StructuredDataId.
-
makeId
public StructuredDataId makeId(java.lang.String defaultId, java.lang.String anEnterpriseNumber)
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.
-
makeId
@Deprecated public StructuredDataId makeId(java.lang.String defaultId, int anEnterpriseNumber)
Deprecated.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
public java.lang.String[] getRequired()
Returns a list of required keys.- Returns:
- a List of required keys or null if none have been provided.
-
getOptional
public java.lang.String[] getOptional()
Returns a list of optional keys.- Returns:
- a List of optional keys or null if none have been provided.
-
getName
public java.lang.String getName()
Returns the StructuredDataId name.- Returns:
- the StructuredDataId name.
-
getEnterpriseNumber
public java.lang.String getEnterpriseNumber()
Returns the enterprise number.- Returns:
- the enterprise number.
-
isReserved
public boolean isReserved()
Indicates if the id is reserved.- Returns:
- true if the id uses the reserved enterprise number, false otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
formatTo
public void formatTo(java.lang.StringBuilder buffer)
- Specified by:
formatTo
in interfaceorg.apache.logging.log4j.util.StringBuilderFormattable
-
-