Class POMOperator

java.lang.Object
io.codemodder.plugins.maven.operator.POMOperator

public class POMOperator extends Object
Facade for the POM Operator, providing methods for modifying and querying POM files.
  • Constructor Details

    • POMOperator

      public POMOperator()
  • Method Details

    • modify

      public static boolean modify(ProjectModel projectModel) throws URISyntaxException, IOException, XMLStreamException
      Bump a Dependency Version on a POM.
      Parameters:
      projectModel - Project Model (Context) class
      Returns:
      true if the modification was successful; otherwise, false.
      Throws:
      URISyntaxException - If there is an issue with the URI syntax.
      IOException - If an I/O error occurs.
      XMLStreamException - If an error occurs while handling XML streams.
    • queryDependency

      public static Collection<Dependency> queryDependency(ProjectModel projectModel) throws URISyntaxException, IOException, XMLStreamException
      Public API - Query for all the artifacts referenced inside a POM File.
      Parameters:
      projectModel - Project Model (Context) Class
      Returns:
      a collection of Dependency objects representing the artifacts referenced in the POM.
      Throws:
      URISyntaxException - If there is an issue with the URI syntax.
      IOException - If an I/O error occurs.
      XMLStreamException - If an error occurs while handling XML streams.
    • queryVersions

      public static Optional<io.codemodder.plugins.maven.operator.VersionQueryResponse> queryVersions(ProjectModel projectModel) throws URISyntaxException, IOException, XMLStreamException
      Public API - Query for all the versions mentioned inside a POM File.
      Parameters:
      projectModel - Project Model (Context) Class
      Returns:
      an optional VersionQueryResponse object containing source and target versions, if found.
      Throws:
      URISyntaxException - If there is an issue with the URI syntax.
      IOException - If an I/O error occurs.
      XMLStreamException - If an error occurs while handling XML streams.
    • mapVersion

      public static com.github.zafarkhaja.semver.Version mapVersion(String version)
      Given a version string, formats and returns it as a semantic version object.

      Versions starting with "1." are appended with ".0".

      Other versions are appended with ".0.0".

      Parameters:
      version - The version string to map.
      Returns:
      the mapped semantic version.