Module hw06

Class AStringLogEntryProcessor

java.lang.Object
provided.logger.util.AStringLogEntryProcessor
All Implemented Interfaces:
ILogEntryProcessor, IStringLogEntryProcessor

public abstract class AStringLogEntryProcessor extends Object implements IStringLogEntryProcessor
A abstract mutable IStringLogEntryProcessor class that enables the string formatter in use to be both accessed and changed. This class provides the internal storage for the ILogEntryFormatter in use. Note: The use of this class is not always feasible in some situations, particularly due to the multiple inheritance limitations of Java.
Author:
swong
  • Field Details

    • leFormatter

      private ILogEntryFormatter leFormatter
      The log entry formatter currently in use.
  • Constructor Details

    • AStringLogEntryProcessor

      public AStringLogEntryProcessor()
      Construct an instance using the ILogEntryFormatter.DEFAULT formatter.
    • AStringLogEntryProcessor

      public AStringLogEntryProcessor(ILogEntryFormatter leFormatter)
      Construct an instance that uses the given log entry formatter.
      Parameters:
      leFormatter - The initial log entry formatter to use.
  • Method Details

    • setLogEntryFormatter

      public void setLogEntryFormatter(ILogEntryFormatter leFormatter)
      Set the log entry formatter in use to be the given formatter
      Specified by:
      setLogEntryFormatter in interface IStringLogEntryProcessor
      Parameters:
      leFormatter - The new log entry formatter to use
    • getLogEntryFormatter

      public ILogEntryFormatter getLogEntryFormatter()
      Get the current log entry formatter in use
      Specified by:
      getLogEntryFormatter in interface IStringLogEntryProcessor
      Returns:
      The log entry formatter in use
    • MakeDefault

      public static final IStringLogEntryProcessor MakeDefault()
      Static factory to instantiate an AStringLogEntryProcessor instance using the ILogEntryFormatter.DEFAULT formatter. Output goes to the console where LogLevel.ERROR level is printed to stderr and other levels are printed to stdout.
      Returns:
      An IStringLogEntryFormatter instance initially
    • MakeDefault

      public static final IStringLogEntryProcessor MakeDefault(ILogEntryFormatter leFormatter)
      Static factory to instantiate an AStringLogEntryProcessor instance using the given ILogEntryFormatter. Output goes to the console where LogLevel.ERROR level is printed to stderr and other levels are printed to stdout.
      Parameters:
      leFormatter - The log entry formatter to use initially
      Returns:
      An IStringLogEntryFormatter instance