aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-09-28 13:00:08 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-09-28 13:00:08 +0000
commit3faeeaeb37725caeade62fad7bc5a13c918d7cc6 (patch)
tree9b816999cf31d7681c77fded80ce3f000dedb5dd /sonar-plugin-api/src
parent90dee8b40e12fc044f854cbe49a35f7d7dff5af3 (diff)
downloadsonarqube-3faeeaeb37725caeade62fad7bc5a13c918d7cc6.tar.gz
sonarqube-3faeeaeb37725caeade62fad7bc5a13c918d7cc6.zip
SONAR-1814 add javadoc
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/ExtensionProvider.java27
1 files changed, 27 insertions, 0 deletions
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.
+ *
+ * <p>Constraints are :
+ * <ul>
+ * <li>the factory is declared in Plugin.getExtensions() as an instance but not as a class</li>
+ * <li>the factory must have a public method named "provide()"</li>
+ * <li>the method provide() must return an object or an array of objects. Collections and classes are excluded.</li>
+ * <li>the methode provide() can accept parameters. These parameters are IoC dependencies.
+ * </ul>
+ * </p>
+ *
+ * <p>Example:
+ * <pre>
+ * public class RuleRepositoryProvider extends ExtensionProvider {
+ * public RuleRepository[] provide(Language[] languages) {
+ * RuleRepository[] result = new RuleRepository[languages.length];
+ * for(int index=0; index &lt; languages.length ; index++) {
+ * Language language = languages[index];
+ * result[index] = new RuleRepository(...);
+ * }
+ * return result;
+ * }
+ * }
+ * </pre>
+ * </p>
+ *
* @since 2.3
*/
public abstract class ExtensionProvider implements Extension, Provider {