Record Class VersionRange
java.lang.Object
java.lang.Record
fr.robie.machineengine.api.version.VersionRange
public record VersionRange(@Nullable Version lower, boolean lowerInclusive, @Nullable Version upper, boolean upperInclusive)
extends Record
A Maven-style version range:
[1.0,2.0), (,1.5], [2.0,), [1.2]
(exactly 1.2), or a bare version 1.2, which means "1.2 or newer".
Ranges compare base versions: qualifiers are ignored.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVersionRange(@Nullable Version lower, boolean lowerInclusive, @Nullable Version upper, boolean upperInclusive) Creates an instance of aVersionRangerecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable Versionlower()Returns the value of thelowerrecord component.booleanReturns the value of thelowerInclusiverecord component.static @NotNull VersionRange@NotNull StringtoString()Returns a string representation of this record class.@Nullable Versionupper()Returns the value of theupperrecord component.booleanReturns the value of theupperInclusiverecord component.
-
Field Details
-
ANY
-
-
Constructor Details
-
VersionRange
public VersionRange(@Nullable @Nullable Version lower, boolean lowerInclusive, @Nullable @Nullable Version upper, boolean upperInclusive) Creates an instance of aVersionRangerecord class.- Parameters:
lower- the value for thelowerrecord componentlowerInclusive- the value for thelowerInclusiverecord componentupper- the value for theupperrecord componentupperInclusive- the value for theupperInclusiverecord component
-
-
Method Details
-
parse
- Throws:
IllegalArgumentException- iftextis not a range
-
contains
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
lower
Returns the value of thelowerrecord component.- Returns:
- the value of the
lowerrecord component
-
lowerInclusive
public boolean lowerInclusive()Returns the value of thelowerInclusiverecord component.- Returns:
- the value of the
lowerInclusiverecord component
-
upper
Returns the value of theupperrecord component.- Returns:
- the value of the
upperrecord component
-
upperInclusive
public boolean upperInclusive()Returns the value of theupperInclusiverecord component.- Returns:
- the value of the
upperInclusiverecord component
-