public class ChainVersionMatcher extends AbstractVersionMatcher
VersionMatcher
chaining several version matchers, and implementing
the VersionMatcher
interface by returning results from the first matcher in the chain
accepting the version.Constructor and Description |
---|
ChainVersionMatcher()
Unique Constructor.
|
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.
|
boolean |
accept(ModuleRevisionId askedMrid,
ModuleRevisionId foundMrid)
Indicates if this version matcher considers that the module revision found matches the asked
one.
|
void |
add(VersionMatcher matcher)
Adds a
VersionMatcher to the chain. |
int |
compare(ModuleRevisionId askedMrid,
ModuleRevisionId foundMrid,
java.util.Comparator<ModuleRevisionId> staticComparator)
This method should be overridden in most cases, because it uses the default contract to
return 1 when it's not possible to know which revision is greater.
|
java.util.List<VersionMatcher> |
getMatchers()
Returns the list of matchers in the chain.
|
boolean |
isDynamic(ModuleRevisionId askedMrid)
Indicates if the given asked ModuleRevisionId should be considered as dynamic for the current
VersionMatcher or not.
|
boolean |
needModuleDescriptor(ModuleRevisionId askedMrid,
ModuleRevisionId foundMrid)
Indicates if this VersionMatcher needs module descriptors to determine if a module revision
matches the asked one.
|
void |
setSettings(IvySettings settings)
Sets the settings this matcher will use, and set to the matcher in the chain which implements
IvySettingsAware . |
getName, getSettings, setName, toString
public void add(VersionMatcher matcher)
VersionMatcher
to the chain.matcher
- the version matcher to add. Must not be nullpublic void setSettings(IvySettings settings)
IvySettingsAware
.setSettings
in interface IvySettingsAware
setSettings
in class AbstractVersionMatcher
settings
- the settings to use in the whole chain. Must not be null.public java.util.List<VersionMatcher> getMatchers()
The list is returned as an unmodifiable view on the actual list of matchers, and will thus reflect further changes made in the chain.
public boolean isDynamic(ModuleRevisionId askedMrid)
VersionMatcher
askedMrid
- the dependency module revision id as asked by a modulepublic int compare(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid, java.util.Comparator<ModuleRevisionId> staticComparator)
AbstractVersionMatcher
compare
in interface VersionMatcher
compare
in class AbstractVersionMatcher
askedMrid
- ModuleRevisionIdfoundMrid
- ModuleRevisionIdstaticComparator
- Comparatorpublic boolean accept(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid)
VersionMatcher
askedMrid
- ModuleRevisionIdfoundMrid
- ModuleRevisionIdpublic boolean needModuleDescriptor(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid)
VersionMatcher
needModuleDescriptor
in interface VersionMatcher
needModuleDescriptor
in class AbstractVersionMatcher
askedMrid
- ModuleRevisionIdfoundMrid
- ModuleRevisionIdpublic boolean accept(ModuleRevisionId askedMrid, ModuleDescriptor foundMD)
VersionMatcher
accept
in interface VersionMatcher
accept
in class AbstractVersionMatcher
askedMrid
- ModuleRevisionIdfoundMD
- ModuleDescriptorCopyright ©2007-2020 The Apache Software Foundation, Licensed under Apache License, Version 2.0.