Interface Messages

  • All Known Implementing Classes:
    DefaultMessages

    public interface Messages

    Messages interface.

    This API provides a modern, flexible way to create and manage build messages/markers that inform users in an IDE about issues in their files. It uses a builder pattern for constructing messages in a more convenient and extensible way compared to the legacy BuildContext message methods.

    Example usage:

     messages.error(Paths.get("/path/to/file.java"))
         .line(42)
         .column(10)
         .create("Syntax error");
     
    • Method Detail

      • clearAll

        void clearAll()
        Clears all messages. This removes all messages that were previously created through this API.
      • clear

        void clear​(java.nio.file.Path path)
        Clears messages associated with a specific path.
        Parameters:
        path - the file path for which to clear messages
      • error

        MessageBuilder error​(java.nio.file.Path path)
        Creates a builder for an error message.
        Parameters:
        path - the file path for which the error message should be created
        Returns:
        a MessageBuilder for constructing the error message
      • warning

        MessageBuilder warning​(java.nio.file.Path path)
        Creates a builder for a warning message.
        Parameters:
        path - the file path for which the warning message should be created
        Returns:
        a MessageBuilder for constructing the warning message
      • info

        MessageBuilder info​(java.nio.file.Path path)
        Creates a builder for an informational message.
        Parameters:
        path - the file path for which the info message should be created
        Returns:
        a MessageBuilder for constructing the info message
      • build

        MessageBuilder build​(MessageType type,
                             java.nio.file.Path path)
        Creates a builder for a message of a specific type. This is the generic method that the other build methods delegate to.
        Parameters:
        type - the type of message to build
        path - the file path for which the message should be created
        Returns:
        a MessageBuilder for constructing the message