From 9d80c9e921a1927b8496af23dbf51f08fc762d23 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 14 Sep 2016 15:49:43 +0200 Subject: [PATCH] SONAR-6407 Missing javadoc on profileImporter and profileExporter --- .../org/sonar/api/profiles/ProfileExporter.java | 14 ++++++++++++++ .../org/sonar/api/profiles/ProfileImporter.java | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java index 3e1dfa846d8..22a458c3751 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileExporter.java @@ -28,6 +28,8 @@ import org.sonar.api.batch.ScannerSide; import org.sonar.api.server.ServerSide; /** + * Export quality profile rules to a file + * * @since 2.3 */ @ScannerSide @@ -45,6 +47,11 @@ public abstract class ProfileExporter { this.name = name; } + /** + * Export activated rule from a quality profile to a writer + * + * Note that the quality profile can contain some rules from other plugins. It should not fail in this case. + */ public abstract void exportProfile(RulesProfile profile, Writer writer); public String getKey() { @@ -65,6 +72,10 @@ public abstract class ProfileExporter { return this; } + /** + * Set the list of languages supported + * An empty value means that it will be available for every languages. + */ protected final ProfileExporter setSupportedLanguages(String... languages) { supportedLanguages = (languages != null) ? languages : new String[0]; return this; @@ -74,6 +85,9 @@ public abstract class ProfileExporter { return mimeType; } + /** + * Set the mime type of the exported file + */ public final ProfileExporter setMimeType(String s) { if (StringUtils.isNotBlank(s)) { this.mimeType = s; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java index e1f65d3b68b..e74e25351ef 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/profiles/ProfileImporter.java @@ -27,6 +27,8 @@ import org.sonar.api.server.ServerSide; import org.sonar.api.utils.ValidationMessages; /** + * Create a quality profile from an external rules file. + * * @since 2.3 */ @ServerSide @@ -42,6 +44,12 @@ public abstract class ProfileImporter { this.importerName = name; } + /** + * Import the profile from a reader. + * + * {@link ValidationMessages#warnings} can be used to return some warnings to the user, for instance when some rules doesn't exist. + * {@link ValidationMessages#errors} can be used when an unrecoverable error is generating during import. No quality profile will be created. + */ public abstract RulesProfile importProfile(Reader reader, ValidationMessages messages); public String getKey() { @@ -62,6 +70,10 @@ public abstract class ProfileImporter { return this; } + /** + * Set the list of languages supported + * An empty value means that it will be available for every languages. + */ protected final ProfileImporter setSupportedLanguages(String... languages) { supportedLanguages = (languages != null) ? languages : new String[0]; return this; -- 2.39.5