Class MavenRefactorVisitor

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Pom model  
      protected java.util.Collection<Pom> modules  
      protected MavenSettings settings  
      • Fields inherited from class org.openrewrite.xml.XmlRefactorVisitor

        formatter
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<Pom.Dependency> findDependencies​(java.lang.String groupId, java.lang.String artifactId)
      Finds dependencies in the model that match the provided group and artifact ids.
      java.util.Collection<Pom.Dependency> findDependencies​(java.util.function.Predicate<Pom.Dependency> matcher)
      Finds dependencies in the model that match the given predicate.
      Pom.Dependency findDependency​(org.openrewrite.xml.tree.Xml.Tag tag)  
      boolean isDependencyTag()  
      boolean isDependencyTag​(java.lang.String groupId, java.lang.String artifactId)  
      boolean isManagedDependencyTag()  
      boolean isManagedDependencyTag​(java.lang.String groupId, java.lang.String artifactId)  
      boolean isParentTag()  
      boolean isPropertyTag()  
      void maybeAddDependency​(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String classifier, java.lang.String scope)  
      org.openrewrite.xml.tree.Xml visitDocument​(org.openrewrite.xml.tree.Xml.Document document)  
      Maven visitMaven​(Maven maven)  
      • Methods inherited from class org.openrewrite.xml.XmlRefactorVisitor

        enclosingRootTag, enclosingTag, visitAttribute, visitCharData, visitComment, visitDocTypeDecl, visitElement, visitIdent, visitProcessingInstruction, visitProlog, visitTag
      • Methods inherited from class org.openrewrite.AbstractRefactorVisitor

        andThen, andThen, next, refactor, refactor, refactor
      • Methods inherited from class org.openrewrite.AbstractSourceVisitor

        getCursor, setCursoringOn, visit, visitAfter, visitAfter
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.openrewrite.RefactorVisitor

        defaultTo, generate, isIdempotent, nextCycle
      • Methods inherited from interface org.openrewrite.SourceVisitor

        getCursor, getName, getTags, reduce, validate, visit, visit, visitTree
      • Methods inherited from interface org.openrewrite.xml.XmlSourceVisitor

        enclosingTag, visitAttribute, visitCharData, visitComment, visitDocTypeDecl, visitElement, visitIdent, visitProcessingInstruction, visitProlog, visitTag
    • Field Detail

      • model

        protected Pom model
      • modules

        protected java.util.Collection<Pom> modules
    • Constructor Detail

      • MavenRefactorVisitor

        public MavenRefactorVisitor()
    • Method Detail

      • visitDocument

        public final org.openrewrite.xml.tree.Xml visitDocument​(org.openrewrite.xml.tree.Xml.Document document)
        Specified by:
        visitDocument in interface org.openrewrite.xml.XmlSourceVisitor<org.openrewrite.xml.tree.Xml>
        Overrides:
        visitDocument in class org.openrewrite.xml.XmlRefactorVisitor
      • isPropertyTag

        public boolean isPropertyTag()
      • isDependencyTag

        public boolean isDependencyTag()
      • isDependencyTag

        public boolean isDependencyTag​(java.lang.String groupId,
                                       @Nullable
                                       java.lang.String artifactId)
      • isManagedDependencyTag

        public boolean isManagedDependencyTag()
      • isManagedDependencyTag

        public boolean isManagedDependencyTag​(java.lang.String groupId,
                                              @Nullable
                                              java.lang.String artifactId)
      • isParentTag

        public boolean isParentTag()
      • findDependency

        @Nullable
        public Pom.Dependency findDependency​(org.openrewrite.xml.tree.Xml.Tag tag)
      • findDependencies

        public java.util.Collection<Pom.Dependency> findDependencies​(java.lang.String groupId,
                                                                     java.lang.String artifactId)
        Finds dependencies in the model that match the provided group and artifact ids.
        Parameters:
        groupId - The groupId to match
        artifactId - The artifactId to match.
        Returns:
        dependencies (including transitive dependencies) with any version matching the provided group and artifact id, if any.
      • findDependencies

        public java.util.Collection<Pom.Dependency> findDependencies​(java.util.function.Predicate<Pom.Dependency> matcher)
        Finds dependencies in the model that match the given predicate.
        Parameters:
        matcher - A dependency test
        Returns:
        dependencies (including transitive dependencies) with any version matching the given predicate.
      • maybeAddDependency

        public void maybeAddDependency​(java.lang.String groupId,
                                       java.lang.String artifactId,
                                       @Nullable
                                       java.lang.String version,
                                       @Nullable
                                       java.lang.String classifier,
                                       @Nullable
                                       java.lang.String scope)