public class VersionFormat extends java.lang.Object implements IVersionFormat, java.io.Serializable
The VersionFormat represents the Omni Version Format in compiled form. It is also a parser for versions of that format.
An instance of VersionFormat is immutable and thus thread safe. The parser does not maintain any state.
| Modifier and Type | Field and Description |
|---|---|
static VersionFormat |
OSGI_FORMAT
The predefined OSGi format that is used when parsing OSGi
versions.
|
static java.lang.String |
OSGI_FORMAT_STRING
The string representation of the Omni Version format used for parsing OSGi versions.
|
static VersionFormat |
RAW_FORMAT
The predefined OSGi format that is used when parsing raw
versions.
|
static java.lang.String |
RAW_FORMAT_STRING
The string representation of the Omni Version format used for parsing raw versions.
|
DEFAULT_MAX_STRING_TRANSLATION, DEFAULT_MIN_STRING_TRANSLATION| Modifier and Type | Method and Description |
|---|---|
static IVersionFormat |
compile(java.lang.String format)
Compile a version format string into a compiled format.
|
static VersionFormat |
compile(java.lang.String format,
int start,
int end)
Compile a version format string into a compiled format.
|
boolean |
equals(java.lang.Object o) |
int |
hashCode() |
Version |
parse(java.lang.String version)
Parse the given version string.
|
static BasicVersion |
parseRaw(java.lang.String version,
IVersionFormat originalFormat,
java.lang.String original)
Parse a version string using the
RAW_FORMAT parser. |
java.lang.String |
toString()
Returns the string representation of this compiled format
|
void |
toString(java.lang.StringBuffer sb)
Appends the string representation of this compiled format to
the given StringBuffer.
|
public static final java.lang.String OSGI_FORMAT_STRING
public static final java.lang.String RAW_FORMAT_STRING
public static final VersionFormat OSGI_FORMAT
public static final VersionFormat RAW_FORMAT
public static IVersionFormat compile(java.lang.String format) throws VersionFormatException
CompiledFormat.compile(format, 0, format.length()).
format - The format to compile.VersionFormatException - If the format could not be compiledpublic static VersionFormat compile(java.lang.String format, int start, int end) throws VersionFormatException
format - The format string to compile.start - Start position in the format stringend - End position in the format stringVersionFormatException - If the format could not be compiledpublic static BasicVersion parseRaw(java.lang.String version, IVersionFormat originalFormat, java.lang.String original)
RAW_FORMAT parser.version - The version to parse.originalFormat - The original format to assign to the created version. Can be null.original - The original version string to assign to the created version. Can be null.java.lang.IllegalArgumentException - If the version string could not be parsed.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic Version parse(java.lang.String version)
IVersionFormatparse in interface IVersionFormatversion - The version string to parse.public java.lang.String toString()
toString in class java.lang.Objectpublic void toString(java.lang.StringBuffer sb)
IVersionFormattoString in interface IVersionFormatsb - The buffer that will receive the string representation