Record Class JdkSpec

java.lang.Object
java.lang.Record
com.dua3.gradle.jdkprovider.types.JdkSpec
Record Components:
os - the operating system family for the JDK
arch - the system architecture for the JDK
version - the version specification for the JDK
vendor - the vendor specification for the JDK
nativeImageCapable - whether the JDK supports native image compilation
javaFxBundled - whether the JDK has JavaFX bundled

@NullMarked public record JdkSpec(OSFamily os, SystemArchitecture arch, Runtime.Version version, String vendor, boolean nativeImageCapable, boolean javaFxBundled) extends Record
Represents specifications for a JDK.

Note: Default values for `os`, `arch`, and `version` are resolved to the current system's operating system, architecture, and version when not explicitly specified during construction.

  • Constructor Details

    • JdkSpec

      public JdkSpec(OSFamily os, SystemArchitecture arch, Runtime.Version version, String vendor, boolean nativeImageCapable, boolean javaFxBundled)
      Creates an instance of a JdkSpec record class.
      Parameters:
      os - the value for the os record component
      arch - the value for the arch record component
      version - the value for the version record component
      vendor - the value for the vendor record component
      nativeImageCapable - the value for the nativeImageCapable record component
      javaFxBundled - the value for the javaFxBundled record component
  • Method Details

    • toString

      public String toString()
      Generates a string representation of the JdkSpec object detailing its characteristics, including version specification, operating system, architecture, vendor, native image capability, and whether JavaFX is bundled. Each attribute is included in the resulting string, separating individual components with a dash ('-').

      Note: The string representation was chosen in a format that can be used as a filename.

      Specified by:
      toString in class Record
      Returns:
      a string representation of the JdkSpec object, formatted as: "jdk-{version}-{os}-{arch}-{vendor}-{nativeImageCapable}-{javaFxBundled}". If any attribute is null, it is represented as "any" in the string.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • os

      public OSFamily os()
      Returns the value of the os record component.
      Returns:
      the value of the os record component
    • arch

      public SystemArchitecture arch()
      Returns the value of the arch record component.
      Returns:
      the value of the arch record component
    • version

      public Runtime.Version version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • vendor

      public String vendor()
      Returns the value of the vendor record component.
      Returns:
      the value of the vendor record component
    • nativeImageCapable

      public boolean nativeImageCapable()
      Returns the value of the nativeImageCapable record component.
      Returns:
      the value of the nativeImageCapable record component
    • javaFxBundled

      public boolean javaFxBundled()
      Returns the value of the javaFxBundled record component.
      Returns:
      the value of the javaFxBundled record component