org.jboss.classloading.spi.version
Class VersionRange

java.lang.Object
  extended by org.jboss.classloading.spi.version.VersionRange
All Implemented Interfaces:
Serializable

public class VersionRange
extends Object
implements Serializable

VersionRange.

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Field Summary
static VersionRange ALL_VERSIONS
          All versions
 
Constructor Summary
VersionRange(Object low)
          Create a new VersionRange with just a low inclusive check
VersionRange(Object low, boolean lowInclusive, Object high, boolean highInclusive)
          Create a new VersionRange.
VersionRange(Object low, Object high)
          Create a new VersionRange with low inclusive and high non-inclusive
 
Method Summary
 boolean equals(Object obj)
           
 Object getHigh()
          Get the high.
 Object getLow()
          Get the low.
 int hashCode()
           
 boolean isConsistent(VersionRange other)
          Check whether two version ranges are consistent
 boolean isHighInclusive()
          Get the highInclusive.
 boolean isInRange(Object version)
          Test whether a version is in range
 boolean isLowInclusive()
          Get the lowInclusive.
 String toString()
           
protected  void validate()
          Validate the range
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALL_VERSIONS

public static final VersionRange ALL_VERSIONS
All versions

Constructor Detail

VersionRange

public VersionRange(Object low)
Create a new VersionRange with just a low inclusive check

Parameters:
low - the low range (null for no lower bound)

VersionRange

public VersionRange(Object low,
                    Object high)
Create a new VersionRange with low inclusive and high non-inclusive

Parameters:
low - the low range (null for no lower bound)
high - the high range (null for no higher bound)

VersionRange

public VersionRange(Object low,
                    boolean lowInclusive,
                    Object high,
                    boolean highInclusive)
Create a new VersionRange.

Parameters:
low - the low range (null for no lower bound)
lowInclusive - whether the low bound is inclusive
high - the high range (null for no higher bound)
highInclusive - whether the high bound is inclusive
Throws:
IllegalArgumentException - if the low or is inclusive but not in the range or the high is less than the low
Method Detail

validate

protected void validate()
Validate the range

Throws:
IllegalArgumentException - for any error

getLow

public Object getLow()
Get the low.

Returns:
the low.

isLowInclusive

public boolean isLowInclusive()
Get the lowInclusive.

Returns:
the lowInclusive.

getHigh

public Object getHigh()
Get the high.

Returns:
the high.

isHighInclusive

public boolean isHighInclusive()
Get the highInclusive.

Returns:
the highInclusive.

isInRange

public boolean isInRange(Object version)
Test whether a version is in range

Parameters:
version - the version to test
Returns:
true when the version is in range
Throws:
IllegalArgumentException - for a null version

isConsistent

public boolean isConsistent(VersionRange other)
Check whether two version ranges are consistent

Parameters:
other - the other version
Returns:
true when the version ranges "overlap"

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.