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 intasInt()get java version as integerstatic JavaVersionfromString(String javaVersion)booleanisJava12Compatible()Test if java version of the project is greater than or equal to 12.booleanisJava6Compatible()Test if java version of the project is greater than or equal to 6.booleanisJava7Compatible()Test if java version of the project is greater than or equal to 7.booleanisJava8Compatible()Test if java version of the project is greater than or equal to 8.booleanisNotSet()Test if java version has been set for the analysis.Stringjava6CompatibilityMessage()Default compatibility message with java 6Stringjava7CompatibilityMessage()Default compatibility message with java 7Stringjava8CompatibilityMessage()Default compatibility message with java 8StringtoString()
-
-
-
Method Detail
-
fromString
public static JavaVersion fromString(@Nullable String javaVersion)
-
isJava6Compatible
public boolean isJava6Compatible()
Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 6.- Specified by:
isJava6Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 6
-
isJava7Compatible
public boolean isJava7Compatible()
Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 7.- Specified by:
isJava7Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 7
-
isJava8Compatible
public boolean isJava8Compatible()
Description copied from interface:JavaVersionTest if java version of the project is greater than or equal to 8.- Specified by:
isJava8Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 8
-
isJava12Compatible
public boolean isJava12Compatible()
Description copied from interface:JavaVersionTest 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:
isJava12Compatiblein interfaceJavaVersion- Returns:
- true if java version used is >= 12
-
java6CompatibilityMessage
public String java6CompatibilityMessage()
Description copied from interface:JavaVersionDefault compatibility message with java 6- Specified by:
java6CompatibilityMessagein interfaceJavaVersion- Returns:
- empty string if java version is properly set, default message otherwise.
-
java7CompatibilityMessage
public String java7CompatibilityMessage()
Description copied from interface:JavaVersionDefault compatibility message with java 7- Specified by:
java7CompatibilityMessagein interfaceJavaVersion- Returns:
- empty string if java version is properly set, default message otherwise.
-
java8CompatibilityMessage
public String java8CompatibilityMessage()
Description copied from interface:JavaVersionDefault compatibility message with java 8- Specified by:
java8CompatibilityMessagein interfaceJavaVersion- Returns:
- empty string if java version is properly set, default message otherwise.
-
asInt
public int asInt()
Description copied from interface:JavaVersionget java version as integer- Specified by:
asIntin interfaceJavaVersion- Returns:
- an int representing the java version
-
isNotSet
public boolean isNotSet()
Description copied from interface:JavaVersionTest if java version has been set for the analysis.- Specified by:
isNotSetin interfaceJavaVersion- Returns:
- false if set, true otherwise.
-
-