Class InitAnalyzer

  • All Implemented Interfaces:
    CheckPom

    public final class InitAnalyzer
    extends Object
    implements CheckPom
    The PomAnalyzer class provides functionality for analyzing and validating Maven POM (Project Object Model) files. This class is designed to read and process the structure of a POM file and identify potential issues or discrepancies in its configuration.

    It supports operations for extracting POM content and performing validations as defined by the CheckPom interface. The class is immutable and safe for concurrent use.

    Instances of PomAnalyzer are created through static factory methods, which allow analysis of default or custom POM file paths.

    • Method Detail

      • analyzePom

        public static InitAnalyzer analyzePom()
                                       throws IOException
        Analyzes the POM file located at the default path "pom.xml" and returns an instance of PomAnalyzer to facilitate further checks or validations.
        Returns:
        an instance of PomAnalyzer for analyzing and validating the contents of the "pom.xml" file.
        Throws:
        IOException - if the POM file cannot be read or accessed.
      • analyzePom

        public static InitAnalyzer analyzePom​(String pomPath)
                                       throws IOException
        Analyzes the specified POM file and returns an instance of PomAnalyzer to facilitate further checks or validations on the POM file's content.
        Parameters:
        pomPath - the path to the POM file to be analyzed
        Returns:
        an instance of PomAnalyzer for analyzing and validating the specified POM file
        Throws:
        IOException - if the specified POM file cannot be read or accessed
      • checking

        public Inclusion<PomAnalyzer> checking​(String givenNode)
        Analyzes the provided POM structure from the given node and returns an Inclusion object containing a PomAnalyzer instance for further validation or analysis. This is the most generic method for analysis.
        Specified by:
        checking in interface CheckPom
        Parameters:
        givenNode - the initial node within the POM structure where analysis should begin
        Returns:
        an Inclusion<PomAnalyzer> instance that wraps a PomAnalyzer configured to analyze the specified POM node with the current state of negation and error handling logic
      • checkingModule

        public Inclusion<ModuleAnalyzer> checkingModule()
        Provides an Inclusion<ModuleAnalyzer> instance for analyzing and validating modules defined in a Maven POM file. This method enables checking whether modules exist, ensuring they contain a `pom.xml` file, and performing additional validations on the specified modules.
        Specified by:
        checkingModule in interface CheckPom
        Returns:
        an Inclusion<ModuleAnalyzer> instance, allowing for further validation, checks, or operations related to the defined modules.