View Javadoc
1   /*******************************************************************************
2    * Copyright (c) 2010, 2011 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 version scheme that handles interpretation of version strings to facilitate their comparison.
15   */
16  public interface VersionScheme
17  {
18  
19      /**
20       * Parses the specified version string, for example "1.0".
21       * 
22       * @param version The version string to parse, must not be {@code null}.
23       * @return The parsed version, never {@code null}.
24       * @throws InvalidVersionSpecificationException If the string violates the syntax rules of this scheme.
25       */
26      Version parseVersion( String version )
27          throws InvalidVersionSpecificationException;
28  
29      /**
30       * Parses the specified version range specification, for example "[1.0,2.0)".
31       * 
32       * @param range The range specification to parse, must not be {@code null}.
33       * @return The parsed version range, never {@code null}.
34       * @throws InvalidVersionSpecificationException If the range specification violates the syntax rules of this scheme.
35       */
36      VersionRange parseVersionRange( String range )
37          throws InvalidVersionSpecificationException;
38  
39      /**
40       * Parses the specified version constraint specification, for example "1.0" or "[1.0,2.0),(2.0,)".
41       * 
42       * @param constraint The constraint specification to parse, must not be {@code null}.
43       * @return The parsed version constraint, never {@code null}.
44       * @throws InvalidVersionSpecificationException If the constraint specification violates the syntax rules of this
45       *             scheme.
46       */
47      VersionConstraint parseVersionConstraint( final String constraint )
48          throws InvalidVersionSpecificationException;
49  
50  }