AbstractVersionMatcher
Date: 2014-12-13

org.apache.ivy.plugins.version

## Class AbstractVersionMatcher

- java.lang.Object
- - org.apache.ivy.plugins.version.AbstractVersionMatcher

- All Implemented Interfaces:
    IvySettingsAware, VersionMatcher
  Direct Known Subclasses:
    ChainVersionMatcher, ExactVersionMatcher, LatestVersionMatcher, PatternVersionMatcher, SubVersionMatcher, VersionRangeMatcher

      public abstract class AbstractVersionMatcher
      extends java.lang.Object
      implements VersionMatcher, IvySettingsAware

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractVersionMatcher()`
    `AbstractVersionMatcher(java.lang.String name)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `accept(ModuleRevisionId askedMrid, ModuleDescriptor foundMD)` Indicates if this version matcher considers that the module found matches the asked one.
    `int` | `compare(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid, java.util.Comparator staticComparator)` This method should be overriden in most cases, because it uses the default contract to return 1 when it's not possible to know which revision is greater.
    `java.lang.String` | `getName()` Returns the version matcher name identifying this version matcher
    `IvySettings` | `getSettings()`
    `boolean` | `needModuleDescriptor(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid)` Indicates if this VersionMatcher needs module descriptors to determine if a module revision matches the asked one.
    `void` | `setName(java.lang.String name)`
    `void` | `setSettings(IvySettings settings)`
    `java.lang.String` | `toString()`

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

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

    - ### Methods inherited from interface org.apache.ivy.plugins.version.VersionMatcher

      `accept, isDynamic`

- - ### Constructor Detail

    - #### AbstractVersionMatcher

          public AbstractVersionMatcher()

    - #### AbstractVersionMatcher

          public AbstractVersionMatcher(java.lang.String name)

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `VersionMatcher`
      Returns the version matcher name identifying this version matcher
      Specified by:
        `getName` in interface `VersionMatcher`
      Returns:
        the version matcher name identifying this version matcher

    - #### setName

          public void setName(java.lang.String name)

    - #### needModuleDescriptor

          public boolean needModuleDescriptor(ModuleRevisionId askedMrid,
                                     ModuleRevisionId foundMrid)

      Description copied from interface: `VersionMatcher`
      Indicates if this VersionMatcher needs module descriptors to determine if a module revision matches the asked one. Note that returning true in this method may imply big performance issues.
      Specified by:
        `needModuleDescriptor` in interface `VersionMatcher`
      Returns:

    - #### accept

          public boolean accept(ModuleRevisionId askedMrid,
                       ModuleDescriptor foundMD)

      Description copied from interface: `VersionMatcher`
      Indicates if this version matcher considers that the module found matches the asked one. This method can be called even needModuleDescriptor(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid) returns false, so it is required to implement it in any case, a usual default implementation being: return accept(askedMrid, foundMD.getResolvedModuleRevisionId());
      Specified by:
        `accept` in interface `VersionMatcher`
      Returns:

    - #### compare

          public int compare(ModuleRevisionId askedMrid,
                    ModuleRevisionId foundMrid,
                    java.util.Comparator staticComparator)

      This method should be overriden in most cases, because it uses the default contract to return 1 when it's not possible to know which revision is greater.
      Specified by:
        `compare` in interface `VersionMatcher`
      Parameters:
        `askedMrid` - the dynamic revision to compare
        `foundMrid` - the static revision to compare
        `staticComparator` - a comparator which can be used to compare static revisions
      Returns:
        0 if it's not possible to know which one is greater, greater than 0 if askedMrid should be considered greater, lower than 0 if it can't be consider greater

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getSettings

          public IvySettings getSettings()

    - #### setSettings

          public void setSettings(IvySettings settings)

      Specified by:
        `setSettings` in interface `IvySettingsAware`