]> git.argeo.org Git - gpl/argeo-slc.git/blob - VersionConstraint.java
dcb3b68ff9fdb1ebcb4216520b0005af93ce2f5e
[gpl/argeo-slc.git] / VersionConstraint.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2014 Sonatype, Inc.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Sonatype, Inc. - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.aether.version;
12
13 /**
14 * A constraint on versions for a dependency. A constraint can either consist of a version range (e.g. "[1, ]") or a
15 * single version (e.g. "1.1"). In the first case, the constraint expresses a hard requirement on a version matching the
16 * range. In the second case, the constraint expresses a soft requirement on a specific version (i.e. a recommendation).
17 */
18 public interface VersionConstraint
19 {
20
21 /**
22 * Gets the version range of this constraint.
23 *
24 * @return The version range or {@code null} if none.
25 */
26 VersionRange getRange();
27
28 /**
29 * Gets the version recommended by this constraint.
30 *
31 * @return The recommended version or {@code null} if none.
32 */
33 Version getVersion();
34
35 /**
36 * Determines whether the specified version satisfies this constraint. In more detail, a version satisfies this
37 * constraint if it matches its version range or if this constraint has no version range and the specified version
38 * equals the version recommended by the constraint.
39 *
40 * @param version The version to test, must not be {@code null}.
41 * @return {@code true} if the specified version satisfies this constraint, {@code false} otherwise.
42 */
43 boolean containsVersion( Version version );
44
45 }