org.eclipse.aether.util.graph.transformer

## Class ConflictResolver.OptionalitySelector

- java.lang.Object
- - org.eclipse.aether.util.graph.transformer.ConflictResolver.OptionalitySelector

- Direct Known Subclasses:
    SimpleOptionalitySelector
  Enclosing class:
    ConflictResolver

      public abstract static class ConflictResolver.OptionalitySelector
      extends Object

  An extension point of `ConflictResolver` that determines the effective optional flag of a dependency from a potentially conflicting set of derived optionalities. The optionality selector gets invoked after the `ConflictResolver.VersionSelector` has picked the winning node. Implementations must be stateless.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConflictResolver.OptionalitySelector()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ConflictResolver.OptionalitySelector` | `getInstance(DependencyNode root, DependencyGraphTransformationContext context)` Retrieves the optionality selector for use during the specified graph transformation.
    `abstract void` | `selectOptionality(ConflictResolver.ConflictContext context)` Determines the effective optional flag of the dependency given by `ConflictResolver.ConflictContext.getWinner()`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ConflictResolver.OptionalitySelector

          public ConflictResolver.OptionalitySelector()

  - ### Method Detail

    - #### getInstance

          public ConflictResolver.OptionalitySelector getInstance(DependencyNode root,
                                                         DependencyGraphTransformationContext context)
                                                           throws RepositoryException

      Retrieves the optionality selector for use during the specified graph transformation. The conflict resolver calls this method once per `ConflictResolver.transformGraph(DependencyNode, DependencyGraphTransformationContext)` invocation to allow implementations to prepare any auxiliary data that is needed for their operation. Given that implementations need to be stateless, a new instance needs to be returned to hold such auxiliary data. The default implementation simply returns the current instance which is appropriate for implementations which do not require auxiliary data.
      Parameters:
        `root` - The root node of the (possibly cyclic!) graph to transform, must not be `null`.
        `context` - The graph transformation context, must not be `null`.
      Returns:
        The optionality selector to use for the given graph transformation, never `null`.
      Throws:
        `RepositoryException` - If the instance could not be retrieved.

    - #### selectOptionality

          public abstract void selectOptionality(ConflictResolver.ConflictContext context)
                                          throws RepositoryException

      Determines the effective optional flag of the dependency given by `ConflictResolver.ConflictContext.getWinner()`. Implementations will usually iterate `ConflictResolver.ConflictContext.getItems()`, inspect `ConflictResolver.ConflictItem.getOptionalities()` and eventually call `ConflictResolver.ConflictContext.setOptional(Boolean)` to deliver the effective optional flag.
      Parameters:
        `context` - The conflict context, must not be `null`.
      Throws:
        `RepositoryException` - If the optionality selection failed.

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