The SourceVersion enum

The SourceVersion enum consists of the following constants:

  • RELEASE_0
  • RELEASE_1
  • RELEASE_2
  • RELEASE_3
  • RELEASE_4
  • RELEASE_5
  • RELEASE_6
  • RELEASE_7
  • RELEASE_8
  • RELEASE_9
It is anticipated that the SourceVersion enum will be updated to include RELEASE_10 and RELEASE_11, as these versions of the Java platform are officially released.

This enum also contains several methods, which are as follows:

Method name: isIdentifier:

public static boolean isIdentifier(CharSequence name)

This method returns true if the parameter string is a Java identifier or keyword.

Method name: isKeyword:

public static boolean isKeyword(CharSequence s)

This method returns true if the given CharSequence is a literal or keyword.

Method name: isName:

public static boolean isName(CharSequence name)

This method returns true if the CharSequence is a valid name.

Method name: latest:

public static SourceVersion latest()

This method returns the latest source version for modeling purposes.

Method name: latestSupported:

public static SourceVersion latestSupported()

This method returns the latest source version that can be fully supported for modeling.

Method name: valueOf:

public static SourceVersion valueOf(String name)

This method returns the enum constant based on the parameter string provided.

You should be aware that the value(String name) method throws two exceptions: IllegalArgumentException and NullPointerException.

Method name: values:

public static SourceVersion[] values()

This method returns an array of the enum constants.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset