Package land.oras

Record Class Platform

Record Components:
os - The operating system of the platform
architecture - The architecture of the platform
variant - The variant of the platform, which is optional and may be null
osVersion - The operating system version of the platform, which is optional and may be
features - The features of the platform, which is optional and may be null
osFeatures - The operating system features of the platform, which is optional and may be

@NullMarked public record Platform(@Nullable String os, @Nullable String architecture, @Nullable String osVersion, @Nullable String variant, @Nullable List<String> features, @Nullable List<String> osFeatures) extends Record
Record for platform information
  • Constructor Details

    • Platform

      public Platform(@Nullable String os, @Nullable String architecture, @Nullable String osVersion, @Nullable String variant, @Nullable List<String> features, @Nullable List<String> osFeatures)
      Creates an instance of a Platform record class.
      Parameters:
      os - the value for the os record component
      architecture - the value for the architecture record component
      osVersion - the value for the osVersion record component
      variant - the value for the variant record component
      features - the value for the features record component
      osFeatures - the value for the osFeatures record component
  • Method Details

    • linuxAmd64

      public static Platform linuxAmd64()
      Create a new platform linux/amd64
      Returns:
      The platform
    • windowsAmd64

      public static Platform windowsAmd64()
      Create a new platform windows/amd64
      Returns:
      The platform
    • linux386

      public static Platform linux386()
      Create a new platform linux/amd64
      Returns:
      The platform
    • linuxArmV6

      public static Platform linuxArmV6()
      Create a new platform linux arm/v6
      Returns:
      The platform
    • linuxArmV7

      public static Platform linuxArmV7()
      Create a new platform linux arm/v7
      Returns:
      The platform
    • linuxArm64V8

      public static Platform linuxArm64V8()
      Create a new platform linux arm64/v8
      Returns:
      The platform
    • linuxPpc64le

      public static Platform linuxPpc64le()
      Create a new platform ppc64le
      Returns:
      The platform
    • linuxRiscv64

      public static Platform linuxRiscv64()
      Create a new platform riscv64
      Returns:
      The platform
    • linuxS390x

      public static Platform linuxS390x()
      Create a new platform s390x
      Returns:
      The platform
    • empty

      public static Platform empty()
      Create a new platform with empty os and architecture
      Returns:
      The platform
    • unknown

      public static Platform unknown()
      Create a new platform with unknown os and architecture
      Returns:
      The platform
    • of

      public static Platform of(String os, String architecture)
      Create a new platform with the given os and architecture
      Parameters:
      os - The os of the platform
      architecture - The architecture of the platform
      Returns:
      The platform
    • of

      public static Platform of(String os, String architecture, @Nullable String variant)
      Create a new platform with the given os, architecture and variant
      Parameters:
      os - The os of the platform
      architecture - The architecture of the platform
      variant - The variant of the platform
      Returns:
      The platform
    • os

      public String os()
      Return the os of the platform, or "unknown" if the os is null
      Returns:
      The os of the platform
    • architecture

      public String architecture()
      Return the os of the platform, or "unknown" if the os is null
      Returns:
      The os of the platform
    • withFeatures

      public Platform withFeatures(List<String> features)
      Create a new platform with the given features
      Parameters:
      features - The features of the platform
      Returns:
      The platform
    • withVariant

      public Platform withVariant(String variant)
      Create a new platform with the given variant
      Parameters:
      variant - The variant of the platform
      Returns:
      The platform
    • withOsVersion

      public Platform withOsVersion(String osVersion)
      Create a new platform with the given os version
      Parameters:
      osVersion - The os version of the platform
      Returns:
      The platform
    • withOsFeatures

      public Platform withOsFeatures(List<String> osFeatures)
      Create a new platform with the given os features
      Parameters:
      osFeatures - The os features of the platform
      Returns:
      The platform
    • unspecified

      public static boolean unspecified(Platform platform)
      Return true if the platform is unspecified, which means both os and architecture are either empty or unknown
      Parameters:
      platform - The platform to check
      Returns:
      True if the platform is unspecified, false otherwise
    • matches

      public static boolean matches(Platform platform, Platform target)
      Check if 2 platform are matching, which means the os and architecture are the same (including variant)
      Parameters:
      platform - The platform to check
      target - The target platform to match
      Returns:
      True if the platform is matching, false otherwise
    • matches

      public static boolean matches(Platform platform, Platform target, boolean includeVersion)
      Check if 2 platform are matching, which means the os and architecture are the same (including variant)
      Parameters:
      platform - The platform to check
      target - The target platform to match
      includeVersion - Whether to include os version
      Returns:
      True if the platform is matching, false otherwise
    • 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.
    • osVersion

      public @Nullable String osVersion()
      Returns the value of the osVersion record component.
      Returns:
      the value of the osVersion record component
    • variant

      public @Nullable String variant()
      Returns the value of the variant record component.
      Returns:
      the value of the variant record component
    • features

      public @Nullable List<String> features()
      Returns the value of the features record component.
      Returns:
      the value of the features record component
    • osFeatures

      public @Nullable List<String> osFeatures()
      Returns the value of the osFeatures record component.
      Returns:
      the value of the osFeatures record component