Class DefaultDependencyNode

    • Constructor Detail

      • DefaultDependencyNode

        public DefaultDependencyNode​(Dependency dependency)
        Creates a new node with the specified dependency.
        Parameters:
        dependency - The dependency associated with this node, may be null for a root node.
      • DefaultDependencyNode

        public DefaultDependencyNode​(Artifact artifact)
        Creates a new root node with the specified artifact as its label. Note that the new node has no dependency, i.e. getDependency() will return null. Put differently, the specified artifact will not be subject to dependency collection/resolution.
        Parameters:
        artifact - The artifact to use as label for this node, may be null.
      • DefaultDependencyNode

        public DefaultDependencyNode​(DependencyNode node)
        Creates a mostly shallow clone of the specified node. The new node has its own copy of any custom data and initially no children.
        Parameters:
        node - The node to copy, must not be null.
    • Method Detail

      • getChildren

        public List<DependencyNodegetChildren()
        Description copied from interface: DependencyNode
        Gets the child nodes of this node. To conserve memory, dependency nodes with equal dependencies may share the same child list instance. Hence clients mutating the child list need to be aware that these changes might affect more than this node. Where this is not desired, the child list should be copied before mutation if the client cannot be sure whether it might be shared with other nodes in the graph.
        Specified by:
        getChildren in interface DependencyNode
        Returns:
        The child nodes of this node, never null.
      • getDependency

        public Dependency getDependency()
        Description copied from interface: DependencyNode
        Gets the dependency associated with this node. Note: For dependency graphs that have been constructed without a root dependency, this method will yield null when invoked on the graph's root node. The root node of such graphs may however still have a label as returned by DependencyNode.getArtifact().
        Specified by:
        getDependency in interface DependencyNode
        Returns:
        The dependency or null if none.
      • getArtifact

        public Artifact getArtifact()
        Description copied from interface: DependencyNode
        Gets the artifact associated with this node. If this node is associated with a dependency, this is equivalent to getDependency().getArtifact(). Otherwise the artifact merely provides a label for this node in which case the artifact must not be subjected to dependency collection/resolution.
        Specified by:
        getArtifact in interface DependencyNode
        Returns:
        The associated artifact or null if none.
      • setArtifact

        public void setArtifact​(Artifact artifact)
        Description copied from interface: DependencyNode
        Updates the artifact of the dependency after resolution. The new artifact must have the same coordinates as the original artifact. This method may only be invoked if this node actually has a dependency, i.e. if DependencyNode.getDependency() is not null.
        Specified by:
        setArtifact in interface DependencyNode
        Parameters:
        artifact - The artifact satisfying the dependency, must not be null.
      • getRelocations

        public List<? extends ArtifactgetRelocations()
        Description copied from interface: DependencyNode
        Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.
        Specified by:
        getRelocations in interface DependencyNode
        Returns:
        The (read-only) sequence of relocations, never null.
      • setRelocations

        public void setRelocations​(List<? extends Artifact> relocations)
        Sets the sequence of relocations that was followed to resolve this dependency's artifact.
        Parameters:
        relocations - The sequence of relocations, may be null.
      • getAliases

        public Collection<? extends ArtifactgetAliases()
        Description copied from interface: DependencyNode
        Gets the known aliases for this dependency's artifact. An alias can be used to mark a patched rebuild of some other artifact as such, thereby allowing conflict resolution to consider the patched and the original artifact as a conflict.
        Specified by:
        getAliases in interface DependencyNode
        Returns:
        The (read-only) set of known aliases, never null.
      • setAliases

        public void setAliases​(Collection<? extends Artifact> aliases)
        Sets the known aliases for this dependency's artifact.
        Parameters:
        aliases - The known aliases, may be null.
      • setVersionConstraint

        public void setVersionConstraint​(VersionConstraint versionConstraint)
        Sets the version constraint that was parsed from the dependency's version declaration.
        Parameters:
        versionConstraint - The version constraint for this node, may be null.
      • setVersion

        public void setVersion​(Version version)
        Sets the version that was selected for the dependency's target artifact.
        Parameters:
        version - The parsed version, may be null.
      • setManagedBits

        public void setManagedBits​(int managedBits)
        Sets a bit field indicating which attributes of this node were subject to dependency management.
        Parameters:
        managedBits - The bit field indicating the managed attributes or 0 if dependency management wasn't applied.
      • setRepositories

        public void setRepositories​(List<RemoteRepository> repositories)
        Sets the remote repositories from which this node's artifact shall be resolved.
        Parameters:
        repositories - The remote repositories to use for artifact resolution, may be null.
      • getData

        public Map<Object,​ObjectgetData()
        Description copied from interface: DependencyNode
        Gets the custom data associated with this dependency node. Clients of the repository system can use this data to annotate dependency nodes with domain-specific information. Note that the returned map is read-only and DependencyNode.setData(Object, Object) needs to be used to update the custom data.
        Specified by:
        getData in interface DependencyNode
        Returns:
        The (read-only) key-value mappings, never null.
      • setData

        public void setData​(Object key,
                            Object value)
        Description copied from interface: DependencyNode
        Associates the specified dependency node data with the given key. Note: This method must not be called while DependencyNode.getData() is being iterated.
        Specified by:
        setData in interface DependencyNode
        Parameters:
        key - The key under which to store the data, must not be null.
        value - The data to associate with the key, may be null to remove the mapping.
      • accept

        public boolean accept​(DependencyVisitor visitor)
        Description copied from interface: DependencyNode
        Traverses this node and potentially its children using the specified visitor.
        Specified by:
        accept in interface DependencyNode
        Parameters:
        visitor - The visitor to call back, must not be null.
        Returns:
        true to visit siblings nodes of this node as well, false to skip siblings.