Class JavaVersionImpl

java.lang.Object
org.sonar.java.model.JavaVersionImpl
All Implemented Interfaces:
JavaVersion

public class JavaVersionImpl extends Object implements JavaVersion
  • Field Details

  • Constructor Details

    • JavaVersionImpl

      public JavaVersionImpl()
    • JavaVersionImpl

      public JavaVersionImpl(int javaVersion)
  • Method Details

    • fromString

      public static JavaVersion fromString(@Nullable String javaVersion)
    • isJava6Compatible

      public boolean isJava6Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 6.
      Specified by:
      isJava6Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 6
    • isJava7Compatible

      public boolean isJava7Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 7.
      Specified by:
      isJava7Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 7
    • isJava8Compatible

      public boolean isJava8Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 8.
      Specified by:
      isJava8Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 8
    • isJava9Compatible

      public boolean isJava9Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 9. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set
      Specified by:
      isJava9Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 9
    • isJava10Compatible

      public boolean isJava10Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 10. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set
      Specified by:
      isJava10Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 10
    • isJava12Compatible

      public boolean isJava12Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 12. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set
      Specified by:
      isJava12Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 12
    • isJava14Compatible

      public boolean isJava14Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 14. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set
      Specified by:
      isJava14Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 14
    • isJava15Compatible

      public boolean isJava15Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 15. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set
      Specified by:
      isJava15Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 15
    • isJava16Compatible

      public boolean isJava16Compatible()
      Description copied from interface: JavaVersion
      Test if java version of the project is greater than or equal to 16. Remark - Contrary to other isJava*Compatible methods, this one will NOT return true if version is not set
      Specified by:
      isJava16Compatible in interface JavaVersion
      Returns:
      true if java version used is >= 16
    • java6CompatibilityMessage

      public String java6CompatibilityMessage()
      Description copied from interface: JavaVersion
      Default compatibility message with java 6
      Specified by:
      java6CompatibilityMessage in interface JavaVersion
      Returns:
      empty string if java version is properly set, default message otherwise.
    • java7CompatibilityMessage

      public String java7CompatibilityMessage()
      Description copied from interface: JavaVersion
      Default compatibility message with java 7
      Specified by:
      java7CompatibilityMessage in interface JavaVersion
      Returns:
      empty string if java version is properly set, default message otherwise.
    • java8CompatibilityMessage

      public String java8CompatibilityMessage()
      Description copied from interface: JavaVersion
      Default compatibility message with java 8
      Specified by:
      java8CompatibilityMessage in interface JavaVersion
      Returns:
      empty string if java version is properly set, default message otherwise.
    • asInt

      public int asInt()
      Description copied from interface: JavaVersion
      get java version as integer
      Specified by:
      asInt in interface JavaVersion
      Returns:
      an int representing the java version
    • isNotSet

      public boolean isNotSet()
      Description copied from interface: JavaVersion
      Test if java version has been set for the analysis.
      Specified by:
      isNotSet in interface JavaVersion
      Returns:
      false if set, true otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object