Package org.codehaus.groovy.control.messages

# Class Message

java.lang.Object
org.codehaus.groovy.control.messages.Message

Direct Known Subclasses:
  `ExceptionMessage`, `SimpleMessage`, `SyntaxErrorMessage`

public abstract class Message extends Object
A base class for compilation messages.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Message()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Message`
  `create(String text, Object data, ProcessingUnit owner)`
  Creates a new `Message` from the specified text and data.
  `static Message`
  `create(String text, ProcessingUnit owner)`
  Creates a new `Message` from the specified text.
  `static Message`
  `create(SyntaxException error, SourceUnit owner)`
  Creates a new `Message` from the specified `SyntaxException`.
  `Diagnostic`
  `toDiagnostic()`
  Returns a format-neutral view of this message: its text and, when known, the source and position it applies to.
  `final void`
  `write(PrintWriter writer)`
  Writes this message to the specified `PrintWriter`.
  `abstract void`
  `write(PrintWriter writer, Janitor janitor)`
  Writes this message to the specified `PrintWriter`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Message

    public Message()

- ## Method Details

  - ### create

    public static Message create(String text, ProcessingUnit owner)
    Creates a new `Message` from the specified text.

  - ### create

    public static Message create(String text, Object data, ProcessingUnit owner)
    Creates a new `Message` from the specified text and data.

  - ### create

    public static Message create(SyntaxException error, SourceUnit owner)
    Creates a new `Message` from the specified `SyntaxException`.

  - ### write

    public abstract void write(PrintWriter writer, Janitor janitor)
    Writes this message to the specified `PrintWriter`. This is the full, human-oriented rendering; other layouts are produced by `ErrorFormat` from `toDiagnostic()`.

  - ### write

    public final void write(PrintWriter writer)
    Writes this message to the specified `PrintWriter`.

  - ### toDiagnostic

    public Diagnostic toDiagnostic()
    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 `write(PrintWriter)` as the text, with no file or position, so that a subclass which does not override this still renders in every format.

    Returns:
      the diagnostic view, never `null`
    Since:
      6.0.0