Enum JavaSEPlatform

    • Field Detail

      • LENGTH

        public static final int LENGTH
        GlassFish Java SE platform enumeration length.
      • MIN_SUPPORTED

        public static final JavaSEPlatform MIN_SUPPORTED
        Lowest supported Java SE platform. Currently it's Java SE 1.8.
      • CURRENT

        public static final JavaSEPlatform CURRENT
        Current Java SE platform.
    • Method Detail

      • values

        public static JavaSEPlatform[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (JavaSEPlatform c : JavaSEPlatform.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static JavaSEPlatform valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • is

        public static boolean is​(JavaSEPlatform platform)
        Check whether current Java SE is exactly matching provided platform.
        Parameters:
        platform - Java SE platform to compare with.
      • atLeast

        public static boolean atLeast​(JavaSEPlatform platform)
        Check whether current Java SE is at least (greater or equal) provided platform.
        Parameters:
        platform - Java SE platform to compare with.
      • toValue

        public static JavaSEPlatform toValue​(String platformName)
        Returns a JavaSEPlatform with a value represented by the specified String. The JavaSEPlatform returned represents existing value only if specified String matches any String returned by versionString() method. Otherwise null value is returned.
        Parameters:
        platformName - Value containing JavaSEPlatform versionString representation.
        Returns:
        JavaSEPlatform value represented by String or null if value was not recognized.
      • toValue

        public static JavaSEPlatform toValue​(int major,
                                             int minor)
        Returns a JavaSEPlatform matching provided major and minor version numbers.
        Parameters:
        major - Major version number.
        minor - Minor version number.
        Returns:
        JavaSEPlatform value matching provided major and minor version numbers. JavaSEPlatform.DEFAULT value is returned for unknown Java SE version numbers.
      • versionString

        public static final String versionString​(int major,
                                                 int minor)
        Generate String containing minor and major version numbers in <major> '.' <minor> format.
        Parameters:
        major - Major version number.
        minor - Minor version number.
        Returns:
        Generated String
      • getMajor

        public final int getMajor()
        Get major version number.
        Returns:
        Major version number.
      • getMinor

        public final int getMinor()
        Get minor version number.
        Returns:
        Minor version number.
      • getAdditionalVersions

        public final JavaSEPlatform.Version[] getAdditionalVersions()
        Get additional version numbers.
        Returns:
        an array of additional version numbers if exist or null if no additional version numbers are defined.
      • gte

        public boolean gte​(JavaSEPlatform platform)
        Check if this platform is equal or greater to specified platform.
        Parameters:
        platform - Platform to compare with.
        Returns:
        Value of true if this platform is equal or greater to specified platform or false otherwise.
      • isSupported

        public boolean isSupported()
        Check whether this platform is supported platform.
        Returns:
        Value of true when this platform is supported platform or false otherwise.
      • versionString

        public String versionString()
        Return computer readable String containing version numbers in <major> '.' <minor> format.
        Returns:
        computer readable String containing version numbers
      • toString

        public String toString()
        Return Java SE platform version as human readable String.
        Overrides:
        toString in class Enum<JavaSEPlatform>
        Returns:
        Java SE platform version as human readable String.