org.mule.devkit.generation.api.gatherer.printing
Class GathererPrinterHelper

java.lang.Object
  extended by org.mule.devkit.generation.api.gatherer.printing.GathererPrinterHelper
All Implemented Interfaces:
PrinterGatherer

public class GathererPrinterHelper
extends Object
implements PrinterGatherer


Constructor Summary
GathererPrinterHelper()
           
 
Method Summary
 void printErrors(NotificationGatherer notificationGatherer, ProcessingEnvironment processingEnv, Context context)
           
 void printKind(List<Notification> notificationsNotes, ProcessingEnvironment processingEnv, Context context, Diagnostic.Kind kind, String singular, String plural)
          Given a list of Notifications, and a criteria to print them (see Diagnostic.Kind), it will iterate over the list to describe while sorting them in a pretty way.
 void printNotes(NotificationGatherer notificationGatherer, ProcessingEnvironment processingEnv, Context context)
           
 void printWarnings(NotificationGatherer notificationGatherer, ProcessingEnvironment processingEnv, Context context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GathererPrinterHelper

public GathererPrinterHelper()
Method Detail

printErrors

public void printErrors(NotificationGatherer notificationGatherer,
                        ProcessingEnvironment processingEnv,
                        Context context)
Specified by:
printErrors in interface PrinterGatherer

printWarnings

public void printWarnings(NotificationGatherer notificationGatherer,
                          ProcessingEnvironment processingEnv,
                          Context context)
Specified by:
printWarnings in interface PrinterGatherer

printNotes

public void printNotes(NotificationGatherer notificationGatherer,
                       ProcessingEnvironment processingEnv,
                       Context context)
Specified by:
printNotes in interface PrinterGatherer

printKind

public void printKind(List<Notification> notificationsNotes,
                      ProcessingEnvironment processingEnv,
                      Context context,
                      Diagnostic.Kind kind,
                      String singular,
                      String plural)

Given a list of Notifications, and a criteria to print them (see Diagnostic.Kind), it will iterate over the list to describe while sorting them in a pretty way. If the list is empty, it will print nothing.

Sample of the output after calling this method for an ERROR scenario: [ERROR] *************************************************** The following (4) errors where encountered while compiling: File: //metadata-grouping-types-integration-tests/src/main/java/org/mule/devkit/it/grouping/BaseGroupingConnector.java 1) @Processor parameter cannot be arrays, use List instead.:28 File: //integration-tests/metadata-grouping-types-integration-tests/src/main/java/org/mule/devkit/it/grouping/categories/Rest_V1_Category.java 2) Must have one only argument of type MetaDataKey.:32 File: //integration-tests/metadata-grouping-types-integration-tests/src/main/java/org/mule/devkit/it/grouping/GroupingConnector.java 3) A @Connect method can only throw a single type of exception. That exception must be ConnectionException.:22 4) @Configurable cannot be applied to field with static modifier.:27 [ERROR] error on execute: An error ocurred while the DevKit was generating Java code. Check the logs for further details.

This method ensures that, in any error scenario, the complete list will be printed in the user's console. This means that, if an exception is thrown while sorting the errors and make them pretty (by invoking getCompleteNotificationLog(java.util.List, javax.annotation.processing.ProcessingEnvironment, String, String)) the COMPLETE list of errors will be printed in the default way.

Sample of the output after calling this method for an ERROR scenario but with some troubles while printing: [ERROR] //metadata-grouping-types-integration-tests/src/main/java/org/mule/devkit/it/grouping/BaseGroupingConnector.java:28 @Processor parameter cannot be arrays, use List instead.:28 [ERROR] //integration-tests/metadata-grouping-types-integration-tests/src/main/java/org/mule/devkit/it/grouping/categories/Rest_V1_Category.java:32 Must have one only argument of type MetaDataKey.:32 [ERROR] //integration-tests/metadata-grouping-types-integration-tests/src/main/java/org/mule/devkit/it/grouping/GroupingConnector.java:22 A @Connect method can only throw a single type of exception. That exception must be ConnectionException.:22 [ERROR] //integration-tests/metadata-grouping-types-integration-tests/src/main/java/org/mule/devkit/it/grouping/GroupingConnector.java:27 @Configurable cannot be applied to field with static modifier.:27 [ERROR] error on execute: An error ocurred while the DevKit was generating Java code. Check the logs for further details.

Parameters:
notificationsNotes - the list of notifications to be printed while sorted
processingEnv - the environment to process the file paths
context - the context needed to print the messages
kind - the type of error we want to be displayed
singular - the label used to describe the header if there is ONE notification in the list
plural - the label used to describe the header if there is TWO (or more) notifications in the list


Copyright © 2010–2015 MuleSoft, Inc.. All rights reserved.