| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2009, 2010 Cloudsmith Inc. and others. |
| 3 |
* |
| 4 |
* This program and the accompanying materials |
| 5 |
* are made available under the terms of the Eclipse Public License 2.0 |
| 6 |
* which accompanies this distribution, and is available at |
| 7 |
* https://www.eclipse.org/legal/epl-2.0/ |
| 8 |
* |
| 9 |
* SPDX-License-Identifier: EPL-2.0 |
| 10 |
* |
| 11 |
* Contributors: |
| 12 |
* Cloudsmith Inc. - initial API and implementation |
| 13 |
*******************************************************************************/ |
| 14 |
package org.eclipse.equinox.p2.metadata; |
| 15 |
|
| 16 |
/** |
| 17 |
* <p>The IVersionFormat represents the Omni Version Format in compiled form. It |
| 18 |
* is also a parser for versions of that format.</p> |
| 19 |
* <p>An instance of IVersionFormat is immutable and thus thread safe. The parser |
| 20 |
* does not maintain any state.</p> |
| 21 |
* @noextend This interface is not intended to be extended by clients. |
| 22 |
* @noimplement This interface is not intended to be implemented by clients. |
| 23 |
* @since 2.0 |
| 24 |
*/ |
| 25 |
public interface IVersionFormat { |
| 26 |
|
| 27 |
/** |
| 28 |
* The string that by default will be interpreted as the logical max string when parsing |
| 29 |
* optional elements of type string and a default that is the empty string (i.e. OSGi) |
| 30 |
*/ |
| 31 |
static final String DEFAULT_MAX_STRING_TRANSLATION = "zzz"; //$NON-NLS-1$ |
| 32 |
|
| 33 |
/** |
| 34 |
* The string that by default will be interpreted as the logical min string when parsing |
| 35 |
* optional elements of type string and a default that is the max string (i.e. Maven triplets) |
| 36 |
*/ |
| 37 |
static final String DEFAULT_MIN_STRING_TRANSLATION = "-"; //$NON-NLS-1$ |
| 38 |
|
| 39 |
/** |
| 40 |
* Appends the string representation of this compiled format to |
| 41 |
* the given StringBuffer. |
| 42 |
* @param sb The buffer that will receive the string representation |
| 43 |
*/ |
| 44 |
void toString(StringBuffer sb); |
| 45 |
|
| 46 |
/** |
| 47 |
* Parse the given version string. |
| 48 |
* @param version The version string to parse. |
| 49 |
* @return A created version. |
| 50 |
* @throws IllegalArgumentException If the version string could not be parsed. |
| 51 |
*/ |
| 52 |
Version parse(String version); |
| 53 |
} |