Merge "ChangeField: skip PatchSets with null revisions" into stable-2.8
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index 7a35115..5e10a62 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -482,7 +482,7 @@
 
 [...]
 
-String language = cfg.get("helloworld")
+String language = cfg.getFromGerritConfig("helloworld")
                      .getString("language", "English");
 ----
 
@@ -528,7 +528,7 @@
 
 [...]
 
-boolean enabled = cfg.get(project, "helloworld")
+boolean enabled = cfg.getFromProjectConfig(project, "helloworld")
                      .getBoolean("enabled", false);
 ----
 
@@ -542,7 +542,7 @@
 
 [...]
 
-boolean enabled = cfg.getWithInheritance(project, "helloworld")
+boolean enabled = cfg.getFromProjectConfigWithInheritance(project, "helloworld")
                      .getBoolean("enabled", false);
 ----
 
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/PluginConfigFactory.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/PluginConfigFactory.java
index 90b6d2f..294d8a5 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/config/PluginConfigFactory.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/PluginConfigFactory.java
@@ -37,12 +37,49 @@
     this.projectStateFactory = projectStateFactory;
   }
 
-  public PluginConfig get(String pluginName) {
+  /**
+   * Returns the configuration for the specified plugin that is stored in the
+   * 'gerrit.config' file.
+   *
+   * The returned plugin configuration provides access to all parameters of the
+   * 'gerrit.config' file that are set in the 'plugin' subsection of the
+   * specified plugin.
+   *
+   * E.g.:
+   *   [plugin "my-plugin"]
+   *     myKey = myValue
+   *
+   * @param pluginName the name of the plugin for which the configuration should
+   *        be returned
+   * @return the plugin configuration from the 'gerrit.config' file
+   */
+  public PluginConfig getFromGerritConfig(String pluginName) {
     return new PluginConfig(pluginName, cfg);
   }
 
-  public PluginConfig get(Project.NameKey projectName, String pluginName)
-      throws NoSuchProjectException {
+  /**
+   * Returns the configuration for the specified plugin that is stored in the
+   * 'project.config' file of the specified project.
+   *
+   * The returned plugin configuration provides access to all parameters of the
+   * 'project.config' file that are set in the 'plugin' subsection of the
+   * specified plugin.
+   *
+   * E.g.:
+   *   [plugin "my-plugin"]
+   *     myKey = myValue
+   *
+   * @param projectName the name of the project for which the plugin
+   *        configuration should be returned
+   * @param pluginName the name of the plugin for which the configuration should
+   *        be returned
+   * @return the plugin configuration from the 'project.config' file of the
+   *         specified project
+   * @throws NoSuchProjectException thrown if the specified project does not
+   *         exist
+   */
+  public PluginConfig getFromProjectConfig(Project.NameKey projectName,
+      String pluginName) throws NoSuchProjectException {
     ProjectState projectState = projectCache.get(projectName);
     if (projectState == null) {
       throw new NoSuchProjectException(projectName);
@@ -50,8 +87,45 @@
     return projectState.getConfig().getPluginConfig(pluginName);
   }
 
-  public PluginConfig getWithInheritance(Project.NameKey projectName,
-      String pluginName) throws NoSuchProjectException {
-    return get(projectName, pluginName).withInheritance(projectStateFactory);
+  /**
+   * Returns the configuration for the specified plugin that is stored in the
+   * 'project.config' file of the specified project. Parameters which are not
+   * set in the 'project.config' of this project are inherited from the parent
+   * project's 'project.config' files.
+   *
+   * The returned plugin configuration provides access to all parameters of the
+   * 'project.config' file that are set in the 'plugin' subsection of the
+   * specified plugin.
+   *
+   * E.g.:
+   * child project:
+   *   [plugin "my-plugin"]
+   *     myKey = childValue
+   *
+   * parent project:
+   *   [plugin "my-plugin"]
+   *     myKey = parentValue
+   *     anotherKey = someValue
+   *
+   * return:
+   *   [plugin "my-plugin"]
+   *     myKey = childValue
+   *     anotherKey = someValue
+   *
+   * @param projectName the name of the project for which the plugin
+   *        configuration should be returned
+   * @param pluginName the name of the plugin for which the configuration should
+   *        be returned
+   * @return the plugin configuration from the 'project.config' file of the
+   *         specified project with inherited non-set parameters from the
+   *         parent projects
+   * @throws NoSuchProjectException thrown if the specified project does not
+   *         exist
+   */
+  public PluginConfig getFromProjectConfigWithInheritance(
+      Project.NameKey projectName, String pluginName)
+      throws NoSuchProjectException {
+    return getFromProjectConfig(projectName, pluginName).withInheritance(
+        projectStateFactory);
   }
 }