From: simonbrandhof
Date: Tue, 28 Sep 2010 13:00:08 +0000 (+0000)
Subject: SONAR-1814 add javadoc
X-Git-Tag: 2.6~928
X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3faeeaeb37725caeade62fad7bc5a13c918d7cc6;p=sonarqube.git
SONAR-1814 add javadoc
---
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionProvider.java
index 615c57a6631..40dcbba5d97 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionProvider.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/ExtensionProvider.java
@@ -22,6 +22,33 @@ package org.sonar.api;
import org.picocontainer.injectors.Provider;
/**
+ * Factory of extensions. It allows to dynamically create extensions depending upon runtime context. A use-case is
+ * to create one rule repository by language.
+ *
+ * Constraints are :
+ *
+ * - the factory is declared in Plugin.getExtensions() as an instance but not as a class
+ * - the factory must have a public method named "provide()"
+ * - the method provide() must return an object or an array of objects. Collections and classes are excluded.
+ * - the methode provide() can accept parameters. These parameters are IoC dependencies.
+ *
+ *
+ *
+ * Example:
+ *
+ * public class RuleRepositoryProvider extends ExtensionProvider {
+ * public RuleRepository[] provide(Language[] languages) {
+ * RuleRepository[] result = new RuleRepository[languages.length];
+ * for(int index=0; index < languages.length ; index++) {
+ * Language language = languages[index];
+ * result[index] = new RuleRepository(...);
+ * }
+ * return result;
+ * }
+ * }
+ *
+ *
+ *
* @since 2.3
*/
public abstract class ExtensionProvider implements Extension, Provider {