Skip to main content
summaryrefslogtreecommitdiffstats
blob: e87df36249adbe0ce68b05fd59113ea515952514 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*******************************************************************************
 * Copyright (c) 2009 Cloudsmith Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Cloudsmith Inc. - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.p2.metadata;

/**
 * <p>The IVersionFormat represents the Omni Version Format in compiled form. It
 * is also a parser for versions of that format.</p>
 * <p>An instance of IVersionFormat is immutable and thus thread safe. The parser
 * does not maintain any state.</p>
 * @since 2.0
 */
public interface IVersionFormat {

	/**
	 * The string that by default will be interpreted as the logical max string when parsing
	 * optional elements of type string and a default that is the empty string (i.e. OSGi)
	 */
	static final String DEFAULT_MAX_STRING_TRANSLATION = "zzz"; //$NON-NLS-1$

	/**
	 * The string that by default will be interpreted as the logical min string when parsing
	 * optional elements of type string and a default that is the max string (i.e. Maven triplets)
	 */
	static final String DEFAULT_MIN_STRING_TRANSLATION = "-"; //$NON-NLS-1$

	/**
	 * Appends the string representation of this compiled format to
	 * the given StringBuffer.
	 * @param sb The buffer that will receive the string representation
	 */
	void toString(StringBuffer sb);

	/**
	 * Parse the given version string.
	 * @param version The version string to parse.
	 * @return A created version.
	 * @throws IllegalArgumentException If the version string could not be parsed.
	 */
	Version parse(String version);
}

Back to the top