Package com.io7m.coffeepick.runtime
Class RuntimeVersionRange
java.lang.Object
com.io7m.coffeepick.runtime.RuntimeVersionRange
- All Implemented Interfaces:
RuntimeVersionRangeType
public final class RuntimeVersionRange extends java.lang.Object implements RuntimeVersionRangeType
A range of runtime versions.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RuntimeVersionRange.Builder
Builds instances of typeRuntimeVersionRange
. -
Method Summary
Modifier and Type Method Description static RuntimeVersionRange.Builder
builder()
Creates a builder forRuntimeVersionRange
.static RuntimeVersionRange
copyOf(RuntimeVersionRangeType instance)
Creates an immutable copy of aRuntimeVersionRangeType
value.boolean
equals(java.lang.Object another)
This instance is equal to all instances ofRuntimeVersionRange
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:lower
,lowerExclusive
,upper
,upperExclusive
.RuntimeVersion
lower()
boolean
lowerExclusive()
static RuntimeVersionRange
of(RuntimeVersion lower, boolean lowerExclusive, RuntimeVersion upper, boolean upperExclusive)
Construct a new immutableRuntimeVersionRange
instance.java.lang.String
toString()
Prints the immutable valueRuntimeVersionRange
with attribute values.RuntimeVersion
upper()
boolean
upperExclusive()
RuntimeVersionRange
withLower(RuntimeVersion value)
Copy the current immutable object by setting a value for thelower
attribute.RuntimeVersionRange
withLowerExclusive(boolean value)
Copy the current immutable object by setting a value for thelowerExclusive
attribute.RuntimeVersionRange
withUpper(RuntimeVersion value)
Copy the current immutable object by setting a value for theupper
attribute.RuntimeVersionRange
withUpperExclusive(boolean value)
Copy the current immutable object by setting a value for theupperExclusive
attribute.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.io7m.coffeepick.runtime.RuntimeVersionRangeType
checkPreconditions, includes, toExternalString
-
Method Details
-
lower
- Specified by:
lower
in interfaceRuntimeVersionRangeType
- Returns:
- The lower bound of the range
-
lowerExclusive
public boolean lowerExclusive()- Specified by:
lowerExclusive
in interfaceRuntimeVersionRangeType
- Returns:
true
iff the lower bound is exclusive
-
upper
- Specified by:
upper
in interfaceRuntimeVersionRangeType
- Returns:
- The upper bound of the range
-
upperExclusive
public boolean upperExclusive()- Specified by:
upperExclusive
in interfaceRuntimeVersionRangeType
- Returns:
true
iff the upper bound is exclusive
-
withLower
Copy the current immutable object by setting a value for thelower
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for lower- Returns:
- A modified copy of the
this
object
-
withLowerExclusive
Copy the current immutable object by setting a value for thelowerExclusive
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for lowerExclusive- Returns:
- A modified copy of the
this
object
-
withUpper
Copy the current immutable object by setting a value for theupper
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for upper- Returns:
- A modified copy of the
this
object
-
withUpperExclusive
Copy the current immutable object by setting a value for theupperExclusive
attribute. A value equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for upperExclusive- Returns:
- A modified copy of the
this
object
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofRuntimeVersionRange
that have equal attribute values.- Overrides:
equals
in classjava.lang.Object
- Returns:
true
ifthis
is equal toanother
instance
-
hashCode
public int hashCode()Computes a hash code from attributes:lower
,lowerExclusive
,upper
,upperExclusive
.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueRuntimeVersionRange
with attribute values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of the value
-
of
public static RuntimeVersionRange of(RuntimeVersion lower, boolean lowerExclusive, RuntimeVersion upper, boolean upperExclusive)Construct a new immutableRuntimeVersionRange
instance.- Parameters:
lower
- The value for thelower
attributelowerExclusive
- The value for thelowerExclusive
attributeupper
- The value for theupper
attributeupperExclusive
- The value for theupperExclusive
attribute- Returns:
- An immutable RuntimeVersionRange instance
-
copyOf
Creates an immutable copy of aRuntimeVersionRangeType
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable RuntimeVersionRange instance
-
builder
Creates a builder forRuntimeVersionRange
.RuntimeVersionRange.builder() .setLower(com.io7m.coffeepick.runtime.RuntimeVersion) // required
lower
.setLowerExclusive(boolean) // requiredlowerExclusive
.setUpper(com.io7m.coffeepick.runtime.RuntimeVersion) // requiredupper
.setUpperExclusive(boolean) // requiredupperExclusive
.build();- Returns:
- A new RuntimeVersionRange builder
-