Class SimpleMessage

java.lang.Object
org.codehaus.groovy.control.messages.Message
org.codehaus.groovy.control.messages.SimpleMessage
Direct Known Subclasses:
LocatedMessage

public class SimpleMessage extends Message
A base class for compilation messages.
  • Field Details

    • data

      protected Object data
      used when message is an I18N identifier
    • message

      protected String message
      Message text to render.
    • owner

      protected ProcessingUnit owner
      Processing unit that owns the message.
  • Constructor Details

    • SimpleMessage

      public SimpleMessage(String message, ProcessingUnit owner)
      Creates a simple message with no auxiliary data.
      Parameters:
      message - the message text
      owner - the owning processing unit
    • SimpleMessage

      public SimpleMessage(String message, Object data, ProcessingUnit owner)
      Creates a simple message with optional auxiliary data.
      Parameters:
      message - the message text
      data - supplemental message data
      owner - the owning processing unit
  • Method Details

    • getMessage

      public String getMessage()
      Returns the message text.
      Returns:
      the message text
    • toDiagnostic

      public Diagnostic toDiagnostic()
      Description copied from class: Message
      Returns a format-neutral view of this message: its text and, when known, the source and position it applies to. Layouts other than the full one are rendered from this rather than from the message classes (GROOVY-12312).

      The default captures the output of Message.write(PrintWriter) as the text, with no file or position, so that a subclass which does not override this still renders in every format.

      Overrides:
      toDiagnostic in class Message
      Returns:
      the diagnostic view, never null
    • write

      public void write(PrintWriter writer, Janitor janitor)
      Writes this message, prefixing it with the source name when available.
      Specified by:
      write in class Message
      Parameters:
      writer - the destination writer
      janitor - the cleanup helper for temporary source access