Record Class ForgeFeature.VersionFeatureTest
java.lang.Object
java.lang.Record
net.neoforged.neoforgespi.locating.ForgeFeature.VersionFeatureTest
- Record Components:
version
- The version we wish to test against
- All Implemented Interfaces:
Predicate<org.apache.maven.artifact.versioning.VersionRange>
,ForgeFeature.IFeatureTest<org.apache.maven.artifact.versioning.VersionRange>
- Enclosing class:
ForgeFeature
public static record ForgeFeature.VersionFeatureTest(IModInfo.DependencySide applicableSides, org.apache.maven.artifact.versioning.ArtifactVersion version)
extends Record
implements ForgeFeature.IFeatureTest<org.apache.maven.artifact.versioning.VersionRange>
Version based feature test. Uses standard MavenVersion system. Will test the constructed version against
ranges requested by mods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IModInfo.DependencySide
The field for theapplicableSides
record component.private final org.apache.maven.artifact.versioning.ArtifactVersion
The field for theversion
record component. -
Constructor Summary
ConstructorsConstructorDescriptionVersionFeatureTest
(IModInfo.DependencySide applicableSides, org.apache.maven.artifact.versioning.ArtifactVersion version) Creates an instance of aVersionFeatureTest
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theapplicableSides
record component.org.apache.maven.artifact.versioning.VersionRange
convertFromString
(String value) final boolean
Indicates whether some other object is "equal to" this one.forVersionString
(IModInfo.DependencySide side, String version) Convenience method for constructing the feature test for a version stringfinal int
hashCode()
Returns a hash code value for this object.boolean
test
(org.apache.maven.artifact.versioning.VersionRange versionRange) final String
toString()
Returns a string representation of this record class.org.apache.maven.artifact.versioning.ArtifactVersion
version()
Returns the value of theversion
record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.neoforged.neoforgespi.locating.ForgeFeature.IFeatureTest
testSideWithString
-
Field Details
-
applicableSides
The field for theapplicableSides
record component. -
version
private final org.apache.maven.artifact.versioning.ArtifactVersion versionThe field for theversion
record component.
-
-
Constructor Details
-
VersionFeatureTest
public VersionFeatureTest(IModInfo.DependencySide applicableSides, org.apache.maven.artifact.versioning.ArtifactVersion version) Creates an instance of aVersionFeatureTest
record class.- Parameters:
applicableSides
- the value for theapplicableSides
record componentversion
- the value for theversion
record component
-
-
Method Details
-
forVersionString
public static ForgeFeature.VersionFeatureTest forVersionString(IModInfo.DependencySide side, String version) Convenience method for constructing the feature test for a version string- Parameters:
version
- the string- Returns:
- the feature test for the supplied string
-
featureValue
- Specified by:
featureValue
in interfaceForgeFeature.IFeatureTest<org.apache.maven.artifact.versioning.VersionRange>
-
test
public boolean test(org.apache.maven.artifact.versioning.VersionRange versionRange) -
convertFromString
- Specified by:
convertFromString
in interfaceForgeFeature.IFeatureTest<org.apache.maven.artifact.versioning.VersionRange>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
applicableSides
Returns the value of theapplicableSides
record component.- Specified by:
applicableSides
in interfaceForgeFeature.IFeatureTest<org.apache.maven.artifact.versioning.VersionRange>
- Returns:
- the value of the
applicableSides
record component
-
version
public org.apache.maven.artifact.versioning.ArtifactVersion version()Returns the value of theversion
record component.- Returns:
- the value of the
version
record component
-