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 Details

    • applicableSides

      private final IModInfo.DependencySide applicableSides
      The field for the applicableSides record component.
    • version

      private final org.apache.maven.artifact.versioning.ArtifactVersion version
      The field for the version record component.
  • Constructor Details

    • VersionFeatureTest

      public VersionFeatureTest(IModInfo.DependencySide applicableSides, org.apache.maven.artifact.versioning.ArtifactVersion version)
      Creates an instance of a VersionFeatureTest record class.
      Parameters:
      applicableSides - the value for the applicableSides record component
      version - the value for the version 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

      public String featureValue()
      Specified by:
      featureValue in interface ForgeFeature.IFeatureTest<org.apache.maven.artifact.versioning.VersionRange>
    • test

      public boolean test(org.apache.maven.artifact.versioning.VersionRange versionRange)
      Specified by:
      test in interface Predicate<org.apache.maven.artifact.versioning.VersionRange>
    • convertFromString

      public org.apache.maven.artifact.versioning.VersionRange convertFromString(String value)
      Specified by:
      convertFromString in interface ForgeFeature.IFeatureTest<org.apache.maven.artifact.versioning.VersionRange>
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • applicableSides

      public IModInfo.DependencySide applicableSides()
      Returns the value of the applicableSides record component.
      Specified by:
      applicableSides in interface ForgeFeature.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 the version record component.
      Returns:
      the value of the version record component