Interface DependencyNode

All Known Implementing Classes:
DefaultDependencyNode

public interface DependencyNode
A node within a dependency graph. To conserve memory, dependency graphs may reuse a given node instance multiple times to represent reoccurring dependencies. As such clients traversing a dependency graph should be prepared to discover multiple paths leading to the same node instance unless the input graph is known to be a duplicate-free tree. Note: Unless otherwise noted, implementation classes are not thread-safe and dependency nodes should not be mutated by concurrent threads.
Restriction:
This interface is not intended to be extended by clients.
Restriction:
This interface is not intended to be implemented by clients.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    A bit flag indicating the exclusions were subject to dependency management
    static final int
    A bit flag indicating the optional flag was subject to dependency management
    static final int
    A bit flag indicating the artifact properties were subject to dependency management
    static final int
    A bit flag indicating the dependency scope was subject to dependency management
    static final int
    A bit flag indicating the dependency version was subject to dependency management
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Traverses this node and potentially its children using the specified visitor.
    Collection<? extends Artifact>
    Gets the known aliases for this dependency's artifact.
    Gets the artifact associated with this node.
    Gets the child nodes of this node.
    Map<?,?>
    Gets the custom data associated with this dependency node.
    Gets the dependency associated with this node.
    int
    Gets a bit field indicating which attributes of this node were subject to dependency management.
    List<? extends Artifact>
    Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.
    Gets the remote repositories from which this node's artifact shall be resolved.
    Gets the request context in which this dependency node was created.
    Gets the version that was selected for the dependency's target artifact.
    Gets the version constraint that was parsed from the dependency's version declaration.
    void
    Updates the artifact of the dependency after resolution.
    void
    Sets the child nodes of this node.
    void
    setData(Object key, Object value)
    Associates the specified dependency node data with the given key.
    void
    Sets the custom data associated with this dependency node.
    void
    setOptional(Boolean optional)
    Sets the optional flag of the dependency.
    void
    Sets the request context in which this dependency node was created.
    void
    Sets the scope of the dependency.
  • Field Details

  • Method Details

    • getChildren

      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.
      Returns:
      The child nodes of this node, never null.
    • setChildren

      void setChildren(List<DependencyNode> children)
      Sets the child nodes of this node.
      Parameters:
      children - The child nodes, may be null
    • getDependency

      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 getArtifact().
      Returns:
      The dependency or null if none.
    • getArtifact

      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.
      Returns:
      The associated artifact or null if none.
    • setArtifact

      void setArtifact(Artifact artifact)
      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 getDependency() is not null.
      Parameters:
      artifact - The artifact satisfying the dependency, must not be null.
    • getRelocations

      Gets the sequence of relocations that was followed to resolve the artifact referenced by the dependency.
      Returns:
      The (read-only) sequence of relocations, never null.
    • getAliases

      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.
      Returns:
      The (read-only) set of known aliases, never null.
    • getVersionConstraint

      Gets the version constraint that was parsed from the dependency's version declaration.
      Returns:
      The version constraint for this node or null.
    • getVersion

      Gets the version that was selected for the dependency's target artifact.
      Returns:
      The parsed version or null.
    • setScope

      void setScope(String scope)
      Sets the scope of the dependency. This method may only be invoked if this node actually has a dependency, i.e. if getDependency() is not null.
      Parameters:
      scope - The scope, may be null.
    • setOptional

      void setOptional(Boolean optional)
      Sets the optional flag of the dependency. This method may only be invoked if this node actually has a dependency, i.e. if getDependency() is not null.
      Parameters:
      optional - The optional flag, may be null.
    • getManagedBits

      Gets a bit field indicating which attributes of this node were subject to dependency management.
      Returns:
      A bit field containing any of the bits MANAGED_VERSION, MANAGED_SCOPE, MANAGED_OPTIONAL, MANAGED_PROPERTIES and MANAGED_EXCLUSIONS if the corresponding attribute was set via dependency management.
    • getRepositories

      Gets the remote repositories from which this node's artifact shall be resolved.
      Returns:
      The (read-only) list of remote repositories to use for artifact resolution, never null.
    • getRequestContext

      Gets the request context in which this dependency node was created.
      Returns:
      The request context, never null.
    • setRequestContext

      void setRequestContext(String context)
      Sets the request context in which this dependency node was created.
      Parameters:
      context - The context, may be null.
    • getData

      Map<?,?> getData()
      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 setData(Object, Object) needs to be used to update the custom data.
      Returns:
      The (read-only) key-value mappings, never null.
    • setData

      void setData(Map<Object,Object> data)
      Sets the custom data associated with this dependency node.
      Parameters:
      data - The new custom data, may be null.
    • setData

      void setData(Object key, Object value)
      Associates the specified dependency node data with the given key. Note: This method must not be called while getData() is being iterated.
      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

      boolean accept(DependencyVisitor visitor)
      Traverses this node and potentially its children using the specified visitor.
      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.