Class ExceptionReportCreator

java.lang.Object
com.vaadin.copilot.exception.report.ExceptionReportCreator

public class ExceptionReportCreator extends Object
A builder-style class used to construct an ExceptionReport instance.

This class collects various pieces of information relevant to an exception report, including a title, component details, relevant data pairs, and component node context. It serves as a flexible intermediary to assemble all necessary parts before creating a finalized ExceptionReport.

  • Constructor Details

    • ExceptionReportCreator

      public ExceptionReportCreator()
  • Method Details

    • addRelevantPair

      public void addRelevantPair(ExceptionReportRelevantPairData pair)
      Method that adds given pair into a list.
      Parameters:
      pair - Pair that is relevant to the action.
    • addRelevantComponentNode

      public void addRelevantComponentNode(ExceptionReportRelevantComponentNode exceptionReportRelevantComponentNode)
      Method that adds relevant nodes into a list
      Parameters:
      exceptionReportRelevantComponentNode - Node to be added
    • addRelevantComponentNode

      public void addRelevantComponentNode(String relevance, tools.jackson.databind.JsonNode component)
      A utility method to add relevant component node for the report. Component node id and ui Id are obtained from component JSON with uiId and nodeId keys
      Parameters:
      relevance - a string that represents the component with the action.
      component - JSON object that should contain nodeId and uiId
    • create

      public ExceptionReport create()
      Creates exception report from the information that is provided. Eliminates irrelevant info from the source that is provided by ComponentInfo and generates a simplified class source code for the report.
      Returns:
      Exception report
    • addComponentInfo

      public void addComponentInfo(ComponentInfo componentInfo)
      Adds single ComponentInfo to the list of component information that are used to extract source code
      Parameters:
      componentInfo - the component information to be added
    • addComponentInfo

      public void addComponentInfo(List<ComponentInfo> componentInfos)
      Adds multiple ComponentInfo objects to the list of component information that are used to extract source code
      Parameters:
      componentInfos - a list of component information objects to be added
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String title)
      Sets title of the report. This will be used in GH as issue title.
      Parameters:
      title - title that represents what exception is about