Package org.revapi

Interface DifferenceAnalyzer<E extends Element<E>>

  • All Superinterfaces:
    AutoCloseable
    All Known Implementing Classes:
    BaseDifferenceAnalyzer

    public interface DifferenceAnalyzer<E extends Element<E>>
    extends AutoCloseable
    An element analyzer is basically a visitor over matching elements of some language between the two API versions being compared.
    Since:
    0.1
    Author:
    Lukas Krejci
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void beginAnalysis​(E oldElement, E newElement)
      Called when the analysis of the two corresponding elements begins.
      Report endAnalysis​(E oldElement, E newElement)
      Called when the analysis of the two elements ends (i.e.
      boolean isDescendRequired​(E oldElement, E newElement)
      Tells whether the analyzer needs to descend "into" the two provided elements.
      void open()
      Called right before the analysis starts.
    • Method Detail

      • open

        void open()
        Called right before the analysis starts. Can be used to "warm up" the analyzer. The corresponding AutoCloseable.close() method is provided through the AutoCloseable super interface.
      • beginAnalysis

        void beginAnalysis​(@Nullable
                           E oldElement,
                           @Nullable
                           E newElement)
        Called when the analysis of the two corresponding elements begins. If those elements contain children, all the children will be analyzed before the endAnalysis(Element, Element) method will be called for these two elements.
        Parameters:
        oldElement - the element from the old archives
        newElement - the element from the new archives
      • isDescendRequired

        boolean isDescendRequired​(@Nullable
                                  E oldElement,
                                  @Nullable
                                  E newElement)
        Tells whether the analyzer needs to descend "into" the two provided elements. This is called after beginAnalysis(Element, Element) and before endAnalysis(Element, Element) with the same pair of elements.

        Note that this decision is made on the "filtered" trees. I.e. if the filters filter out children of an element, the analyzer cannot override that decision and try to include such elements in the analysis again.

        Parameters:
        oldElement - the element from the old archives
        newElement - the element from the new archives
        Returns:
        true when the analysis should also include the children of the provided elements, false otherwise.
      • endAnalysis

        Report endAnalysis​(@Nullable
                           E oldElement,
                           @Nullable
                           E newElement)
        Called when the analysis of the two elements ends (i.e. all the children have been visited).
        Parameters:
        oldElement - the element from the old archives
        newElement - the element from the new archives
        Returns:
        a report detailing the difference found between these two elements