diff options
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java index a7907b6b08e..6214d8d4e53 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ExtensionUtils.java @@ -60,6 +60,12 @@ public final class ExtensionUtils { return false; } + static boolean isMavenExtensionOnly(Object extension) { + Class clazz = (extension instanceof Class ? (Class) extension : extension.getClass()); + SupportedEnvironment env = AnnotationUtils.getClassAnnotation(clazz, SupportedEnvironment.class); + return env!=null && env.value().length==1 && StringUtils.equalsIgnoreCase("maven", env.value()[0]); + } + static boolean isType(Object extension, Class<? extends Extension> extensionClass) { Class clazz = (extension instanceof Class ? (Class) extension : extension.getClass()); return extensionClass.isAssignableFrom(clazz); |