|
OSGi™ Core Release 6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.osgi.framework.VersionRange
public class VersionRange
Version range. A version range is an interval describing a set of
versions.
A range has a left (lower) endpoint and a right (upper) endpoint. Each endpoint can be open (excluded from the set) or closed (included in the set).
VersionRange objects are immutable.
| Field Summary | |
|---|---|
static char |
LEFT_CLOSED
The left endpoint is closed and is included in the range. |
static char |
LEFT_OPEN
The left endpoint is open and is excluded from the range. |
static char |
RIGHT_CLOSED
The right endpoint is closed and is included in the range. |
static char |
RIGHT_OPEN
The right endpoint is open and is excluded from the range. |
| Constructor Summary | |
|---|---|
VersionRange(char leftType,
Version leftEndpoint,
Version rightEndpoint,
char rightType)
Creates a version range from the specified versions. |
|
VersionRange(String range)
Creates a version range from the specified string. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object object)
Compares this VersionRange object to another object. |
Version |
getLeft()
Returns the left endpoint of this version range. |
char |
getLeftType()
Returns the type of the left endpoint of this version range. |
Version |
getRight()
Returns the right endpoint of this version range. |
char |
getRightType()
Returns the type of the right endpoint of this version range. |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
includes(Version version)
Returns whether this version range includes the specified version. |
VersionRange |
intersection(VersionRange... ranges)
Returns the intersection of this version range with the specified version ranges. |
boolean |
isEmpty()
Returns whether this version range is empty. |
boolean |
isExact()
Returns whether this version range contains only a single version. |
String |
toFilterString(String attributeName)
Returns the filter string for this version range using the specified attribute name. |
String |
toString()
Returns the string representation of this version range. |
static VersionRange |
valueOf(String range)
Returns a VersionRange object holding the version range in the
specified String. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final char LEFT_OPEN
The value of LEFT_OPEN is '('.
public static final char LEFT_CLOSED
The value of LEFT_CLOSED is '['.
public static final char RIGHT_OPEN
The value of RIGHT_OPEN is ')'.
public static final char RIGHT_CLOSED
The value of RIGHT_CLOSED is ']'.
| Constructor Detail |
|---|
public VersionRange(char leftType,
Version leftEndpoint,
Version rightEndpoint,
char rightType)
leftType - Must be either LEFT_CLOSED or LEFT_OPEN
.leftEndpoint - Left endpoint of range. Must not be null.rightEndpoint - Right endpoint of range. May be null to
indicate the right endpoint is Infinity.rightType - Must be either RIGHT_CLOSED or
RIGHT_OPEN.
IllegalArgumentException - If the arguments are invalid.public VersionRange(String range)
Version range string grammar:
range ::= interval | atleast
interval ::= ( '[' | '(' ) left ',' right ( ']' | ')' )
left ::= version
right ::= version
atleast ::= version
range - String representation of the version range. The versions in
the range must contain no whitespace. Other whitespace in the
range string is ignored. Must not be null.
IllegalArgumentException - If range is improperly
formatted.| Method Detail |
|---|
public Version getLeft()
public Version getRight()
null which indicates the right
endpoint is Infinity.public char getLeftType()
LEFT_CLOSED if the left endpoint is closed or
LEFT_OPEN if the left endpoint is open.public char getRightType()
RIGHT_CLOSED if the right endpoint is closed or
RIGHT_OPEN if the right endpoint is open.public boolean includes(Version version)
version - The version to test for inclusion in this version range.
true if the specified version is included in this version
range; false otherwise.public VersionRange intersection(VersionRange... ranges)
ranges - The version ranges to intersect with this version range.
public boolean isEmpty()
true if this version range is empty; false
otherwise.public boolean isExact()
true if this version range contains only a single
version; false otherwise.public String toString()
The format of the version range string will be a version string if the
right end point is Infinity (null) or an interval string.
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object object)
VersionRange object to another object.
A version range is considered to be equal to another version
range if both the endpoints and their types are equal or if both version
ranges are empty.
equals in class Objectobject - The VersionRange object to be compared.
true if object is a VersionRange and is
equal to this object; false otherwise.public String toFilterString(String attributeName)
attributeName - The attribute name to use in the returned filter
string.
IllegalArgumentException - If the specified attribute name is not a
valid attribute name.public static VersionRange valueOf(String range)
VersionRange object holding the version range in the
specified String.
See VersionRange(String) for the format of the version range
string.
range - String representation of the version range. The versions in
the range must contain no whitespace. Other whitespace in the
range string is ignored. Must not be null.
VersionRange object representing the version range.
IllegalArgumentException - If range is improperly
formatted.
|
OSGi™ Core Release 6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||