Class LiteralPatternConverter

All Implemented Interfaces:
ArrayPatternConverter, PatternConverter

public final class LiteralPatternConverter extends LogEventPatternConverter implements ArrayPatternConverter
Formats a string literal.
  • Field Details

    • literal

      private final String literal
      String literal.
    • config

      private final Configuration config
    • substitute

      private final boolean substitute
  • Constructor Details

    • LiteralPatternConverter

      public LiteralPatternConverter(Configuration config, String literal, boolean convertBackslashes)
      Create a new instance.
      Parameters:
      config - The Configuration.
      literal - string literal.
      convertBackslashes - if true, backslash characters are treated as escape characters and character sequences like "\" followed by "t" (backslash+t) are converted to special characters like '\t' (tab).
  • Method Details

    • containsSubstitutionSequence

      static boolean containsSubstitutionSequence(String literal)
    • format

      public void format(LogEvent event, StringBuilder toAppendTo)
      Formats an event into a string buffer.
      Specified by:
      format in class LogEventPatternConverter
      Parameters:
      event - event to format, may not be null.
      toAppendTo - string buffer to which the formatted event will be appended. May not be null.
    • format

      public void format(Object obj, StringBuilder output)
      Formats an object into a string buffer.
      Specified by:
      format in interface PatternConverter
      Overrides:
      format in class LogEventPatternConverter
      Parameters:
      obj - event to format, may not be null.
      output - string buffer to which the formatted event will be appended. May not be null.
    • format

      public void format(StringBuilder output, Object... objects)
      Formats an array of Objects.
      Specified by:
      format in interface ArrayPatternConverter
      Parameters:
      output - The StringBuilder to add the content to.
      objects - The Object array.
    • getLiteral

      public String getLiteral()
    • isVariable

      public boolean isVariable()
      Overrides:
      isVariable in class LogEventPatternConverter
    • toString

      public String toString()
      Overrides:
      toString in class Object