Package org.sonar.java.model
Class JavaVersionImpl
- java.lang.Object
-
- org.sonar.java.model.JavaVersionImpl
-
- All Implemented Interfaces:
JavaVersion
public class JavaVersionImpl extends Object implements JavaVersion
-
-
Field Summary
-
Fields inherited from interface org.sonar.plugins.java.api.JavaVersion
SOURCE_VERSION
-
-
Constructor Summary
Constructors Constructor Description JavaVersionImpl()
JavaVersionImpl(int javaVersion)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
asInt()
get java version as integerstatic JavaVersion
fromString(String javaVersion)
boolean
isJava12Compatible()
Test if java version of the project is greater than or equal to 12.boolean
isJava6Compatible()
Test if java version of the project is greater than or equal to 6.boolean
isJava7Compatible()
Test if java version of the project is greater than or equal to 7.boolean
isJava8Compatible()
Test if java version of the project is greater than or equal to 8.boolean
isNotSet()
Test if java version has been set for the analysis.String
java6CompatibilityMessage()
Default compatibility message with java 6String
java7CompatibilityMessage()
Default compatibility message with java 7String
java8CompatibilityMessage()
Default compatibility message with java 8String
toString()
-
-
-
Method Detail
-
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 interfaceJavaVersion
- 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 interfaceJavaVersion
- 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 interfaceJavaVersion
- Returns:
- true if java version used is >= 8
-
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 interfaceJavaVersion
- Returns:
- true if java version used is >= 12
-
java6CompatibilityMessage
public String java6CompatibilityMessage()
Description copied from interface:JavaVersion
Default compatibility message with java 6- Specified by:
java6CompatibilityMessage
in interfaceJavaVersion
- 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 interfaceJavaVersion
- 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 interfaceJavaVersion
- 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 interfaceJavaVersion
- 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 interfaceJavaVersion
- Returns:
- false if set, true otherwise.
-
-