org.eclipse.aether.collection

## Interface VersionFilter

- All Known Implementing Classes:
    ChainedVersionFilter, ContextualSnapshotVersionFilter, HighestVersionFilter, SnapshotVersionFilter

      public interface VersionFilter

  Decides which versions matching a version range should actually be considered for the dependency graph. The version filter is not invoked for dependencies that do not declare a version range but a single version.

  Note: Implementations must be stateless.

  Warning: This hook is called from a hot spot and therefore implementations should pay attention to performance. Among others, implementations should provide a semantic `equals()` method.

  See Also:
    `RepositorySystemSession.getVersionFilter()`, `RepositorySystem.collectDependencies(org.eclipse.aether.RepositorySystemSession, CollectRequest)`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `VersionFilter.VersionFilterContext` A context used during version filtering to hold relevant data.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `VersionFilter` | `deriveChildFilter(DependencyCollectionContext context)` Derives a version filter for the specified collection context.
    `void` | `filterVersions(VersionFilter.VersionFilterContext context)` Filters the available versions for a given dependency.

- - ### Method Detail

    - #### filterVersions

          void filterVersions(VersionFilter.VersionFilterContext context)
                              throws RepositoryException

      Filters the available versions for a given dependency. Implementations will usually call `context.iterator()` to inspect the available versions and use `Iterator.remove()` to delete unacceptable versions. If no versions remain after all filtering has been performed, the dependency collection process will automatically fail, i.e. implementations need not handle this situation on their own.
      Parameters:
        `context` - The version filter context, must not be `null`.
      Throws:
        `RepositoryException` - If the filtering could not be performed.

    - #### deriveChildFilter

          VersionFilter deriveChildFilter(DependencyCollectionContext context)

      Derives a version filter for the specified collection context. The derived filter will be used to handle version ranges encountered in child dependencies of the current node. When calculating the child filter, implementors are strongly advised to simply return the current instance if nothing changed to help save memory.
      Parameters:
        `context` - The dependency collection context, must not be `null`.
      Returns:
        The version filter for the target node or `null` if versions should not be filtered any more.

Copyright © 2010-2014 The Eclipse Foundation. All Rights Reserved.