Interface MessagerUtils

  • All Superinterfaces:
    Utils

    public interface MessagerUtils
    extends Utils
    Messager utilities class
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    Messager
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static void printError​(javax.annotation.processing.Messager messager, java.lang.String pattern, java.lang.Object... args)
      Prints an error message using the provided Messager.
      static void printError​(javax.annotation.processing.ProcessingEnvironment processingEnv, java.lang.String pattern, java.lang.Object... args)
      Prints an error message using the ProcessingEnvironment's Messager.
      static void printMandatoryWarning​(javax.annotation.processing.Messager messager, java.lang.String pattern, java.lang.Object... args)
      Prints a mandatory warning message using the provided Messager.
      static void printMandatoryWarning​(javax.annotation.processing.ProcessingEnvironment processingEnv, java.lang.String pattern, java.lang.Object... args)
      Prints a mandatory warning message using the ProcessingEnvironment's Messager.
      static void printMessage​(javax.annotation.processing.Messager messager, javax.tools.Diagnostic.Kind kind, java.lang.String pattern, java.lang.Object... args)
      Prints a message of the specified kind using the provided Messager.
      static void printMessage​(javax.annotation.processing.ProcessingEnvironment processingEnv, javax.tools.Diagnostic.Kind kind, java.lang.String pattern, java.lang.Object... args)
      Prints a message of the specified kind using the ProcessingEnvironment's Messager.
      static void printNote​(javax.annotation.processing.Messager messager, java.lang.String pattern, java.lang.Object... args)
      Prints a note message using the provided Messager.
      static void printNote​(javax.annotation.processing.ProcessingEnvironment processingEnv, java.lang.String pattern, java.lang.Object... args)
      Prints a note message using the ProcessingEnvironment's Messager.
      static void printWarning​(javax.annotation.processing.Messager messager, java.lang.String pattern, java.lang.Object... args)
      Prints a warning message using the provided Messager.
      static void printWarning​(javax.annotation.processing.ProcessingEnvironment processingEnv, java.lang.String pattern, java.lang.Object... args)
      Prints a warning message using the ProcessingEnvironment's Messager.
    • Method Detail

      • printNote

        static void printNote​(javax.annotation.processing.ProcessingEnvironment processingEnv,
                              java.lang.String pattern,
                              java.lang.Object... args)
        Prints a note message using the ProcessingEnvironment's Messager.

        This method formats the message using the provided pattern and arguments, and delegates to the underlying Messager obtained from the processing environment.

        Example Usage

         ProcessingEnvironment processingEnv = ...; // Obtain processing environment
         printNote(processingEnv, "Found {0} elements matching criteria", count);
         
        Parameters:
        processingEnv - the processing environment to obtain the messager from
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printNote

        static void printNote​(javax.annotation.processing.Messager messager,
                              java.lang.String pattern,
                              java.lang.Object... args)
        Prints a note message using the provided Messager.

        This method formats the message using the provided pattern and arguments, and forwards it to the underlying Messager.

        Example Usage

         Messager messager = processingEnv.getMessager();
         printNote(messager, "Found {0} elements matching criteria", count);
         
        Parameters:
        messager - the messager to use for printing the message
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printWarning

        static void printWarning​(javax.annotation.processing.ProcessingEnvironment processingEnv,
                                 java.lang.String pattern,
                                 java.lang.Object... args)
        Prints a warning message using the ProcessingEnvironment's Messager.

        This method formats the message using the provided pattern and arguments, and delegates to the underlying Messager obtained from the processing environment. The message will be logged at the warning level through both the Messager and internal logging utilities.

        Example Usage

         ProcessingEnvironment processingEnv = ...; // Obtain processing environment
         printWarning(processingEnv, "Found {0} deprecated elements", count);
         
        Parameters:
        processingEnv - the processing environment to obtain the messager from
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printWarning

        static void printWarning​(javax.annotation.processing.Messager messager,
                                 java.lang.String pattern,
                                 java.lang.Object... args)
        Prints a warning message using the provided Messager.

        This method formats the message using the provided pattern and arguments, and forwards it to the underlying Messager as a warning level message. The message will also be logged through internal logging utilities at the warning level.

        Example Usage

         Messager messager = processingEnv.getMessager();
         printWarning(messager, "Found {0} deprecated elements", count);
         
        Parameters:
        messager - the messager to use for printing the message
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printMandatoryWarning

        static void printMandatoryWarning​(javax.annotation.processing.ProcessingEnvironment processingEnv,
                                          java.lang.String pattern,
                                          java.lang.Object... args)
        Prints a mandatory warning message using the ProcessingEnvironment's Messager.

        This method formats the message using the provided pattern and arguments, and delegates to the underlying Messager obtained from the processing environment. The message will be logged at the warning level through both the Messager and internal logging utilities.

        Example Usage

         ProcessingEnvironment processingEnv = ...; // Obtain processing environment
         printMandatoryWarning(processingEnv, "Found {0} obsolete elements", count);
         
        Parameters:
        processingEnv - the processing environment to obtain the messager from
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printMandatoryWarning

        static void printMandatoryWarning​(javax.annotation.processing.Messager messager,
                                          java.lang.String pattern,
                                          java.lang.Object... args)
        Prints a mandatory warning message using the provided Messager.

        This method formats the message using the provided pattern and arguments, and forwards it to the underlying Messager as a mandatory warning level message. The message will also be logged through internal logging utilities at the warning level.

        Example Usage

         Messager messager = processingEnv.getMessager();
         printMandatoryWarning(messager, "Found {0} obsolete elements", count);
         
        Parameters:
        messager - the messager to use for printing the message
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printError

        static void printError​(javax.annotation.processing.ProcessingEnvironment processingEnv,
                               java.lang.String pattern,
                               java.lang.Object... args)
        Prints an error message using the ProcessingEnvironment's Messager.

        This method formats the message using the provided pattern and arguments, and delegates to the underlying Messager obtained from the processing environment. The message will be logged at the error level through both the Messager and internal logging utilities.

        Example Usage

         ProcessingEnvironment processingEnv = ...; // Obtain processing environment
         printError(processingEnv, "Failed to process {0} elements", count);
         
        Parameters:
        processingEnv - the processing environment to obtain the messager from
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printError

        static void printError​(javax.annotation.processing.Messager messager,
                               java.lang.String pattern,
                               java.lang.Object... args)
        Prints an error message using the provided Messager.

        This method formats the message using the provided pattern and arguments, and forwards it to the underlying Messager as an error level message. The message will also be logged through internal logging utilities at the error level.

        Example Usage

         Messager messager = processingEnv.getMessager();
         printError(messager, "Failed to process {0} elements", count);
         
        Parameters:
        messager - the messager to use for printing the message
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printMessage

        static void printMessage​(javax.annotation.processing.ProcessingEnvironment processingEnv,
                                 javax.tools.Diagnostic.Kind kind,
                                 java.lang.String pattern,
                                 java.lang.Object... args)
        Prints a message of the specified kind using the ProcessingEnvironment's Messager.

        This method retrieves the Messager from the provided ProcessingEnvironment and delegates to the printMessage(Messager, Kind, String, Object...) method to handle message formatting and output.

        Example Usage

         ProcessingEnvironment processingEnv = ...; // Obtain processing environment
         printMessage(processingEnv, Kind.WARNING, "Found {0} deprecated elements", count);
         
        Parameters:
        processingEnv - the processing environment to obtain the messager from
        kind - the kind of message to print (e.g., error, warning, note)
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern
      • printMessage

        static void printMessage​(javax.annotation.processing.Messager messager,
                                 javax.tools.Diagnostic.Kind kind,
                                 java.lang.String pattern,
                                 java.lang.Object... args)
        Prints a message of the specified kind using the provided Messager.

        This method formats the message using the provided pattern and arguments, sends it to the annotation processor's messager, and also logs it using internal logging utilities at the appropriate level.

        Example Usage

         Messager messager = processingEnv.getMessager();
         printMessage(messager, Kind.ERROR, "Failed to process {0} elements", count);
         
        Parameters:
        messager - the messager to use for printing the message
        kind - the kind of message to print (e.g., error, warning, note)
        pattern - the message pattern to format (supports String.format(java.lang.String, java.lang.Object...) syntax)
        args - the arguments for the message pattern