Class StructuredDataId

java.lang.Object
org.apache.logging.log4j.message.StructuredDataId
All Implemented Interfaces:
Serializable, StringBuilderFormattable

public class StructuredDataId extends Object implements Serializable, StringBuilderFormattable
The StructuredData identifier.
See Also:
  • Field Details

  • Constructor Details

    • StructuredDataId

      public StructuredDataId(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(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(String name, String[] required, String[] optional)
      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

      public StructuredDataId(String name, String[] required, 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.
      maxLength - The maximum length of the id's name.
      Since:
      2.9
    • StructuredDataId

      public StructuredDataId(String name, String enterpriseNumber, String[] required, 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 @InlineMe(replacement="this(name, String.valueOf(enterpriseNumber), required, optional)") public StructuredDataId(String name, int enterpriseNumber, String[] required, 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

      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.9
    • StructuredDataId

      @InlineMe(replacement="this(name, String.valueOf(enterpriseNumber), required, optional, maxLength)") @Deprecated public StructuredDataId(String name, int 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.9
  • Method Details

    • 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(String defaultId, 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 @InlineMe(replacement="this.makeId(defaultId, String.valueOf(anEnterpriseNumber))") public final StructuredDataId makeId(String defaultId, int anEnterpriseNumber)
      Deprecated.
      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.
    • getRequired

      public String[] getRequired()
      Returns a list of required keys.
      Returns:
      a List of required keys or null if none have been provided.
    • getOptional

      public String[] getOptional()
      Returns a list of optional keys.
      Returns:
      a List of optional keys or null if none have been provided.
    • getName

      public String getName()
      Returns the StructuredDataId name.
      Returns:
      the StructuredDataId name.
    • getEnterpriseNumber

      public 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 String toString()
      Overrides:
      toString in class Object
    • formatTo

      public void formatTo(StringBuilder buffer)
      Description copied from interface: StringBuilderFormattable
      Writes a text representation of this object into the specified StringBuilder, ideally without allocating temporary objects.
      Specified by:
      formatTo in interface StringBuilderFormattable
      Parameters:
      buffer - the StringBuilder to write into