All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.prezi.pride.ivyversions.ResolverStrategy Maven / Gradle / Ivy

There is a newer version: 0.12.3
Show newest version
package com.prezi.pride.ivyversions;

import com.google.common.collect.ImmutableList;

import java.util.List;

public class ResolverStrategy {
	private final List matchers;

	public ResolverStrategy() {
		ImmutableList.Builder matcherBuilder = ImmutableList.builder();
		matcherBuilder.add(new VersionRangeMatcher(new ExactVersionMatcher()));
		matcherBuilder.add(new SubVersionMatcher(new ExactVersionMatcher()));
		matcherBuilder.add(new LatestVersionMatcher());
		matcherBuilder.add(new ExactVersionMatcher());
		this.matchers = matcherBuilder.build();
	}

	public boolean accept(String selector, String candidate) {
		for (VersionMatcher matcher : matchers) {
			if (matcher.canHandle(selector)) {
				return matcher.accept(selector, candidate);
			}
		}
		throw new IllegalArgumentException("Invalid version selector: " + selector);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy