Tidy up imports
Use `import static` instead of explicit references in the code.
Change-Id: I4ce04b325ccfe940ce51457c332d59288aee7543
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/CheckoutCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/CheckoutCommand.java
index 7507556..d0c70ba 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/CheckoutCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/CheckoutCommand.java
@@ -14,6 +14,8 @@
package com.googlesource.gerrit.plugins.download.command;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.CHECKOUT;
+
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.server.config.DownloadConfig;
import com.google.inject.Inject;
@@ -22,7 +24,7 @@
public class CheckoutCommand extends GitDownloadCommand {
@Inject
CheckoutCommand(DownloadConfig downloadConfig) {
- super(downloadConfig, com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.CHECKOUT);
+ super(downloadConfig, CHECKOUT);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/CherryPickCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/CherryPickCommand.java
index 6e46c22..a28bd0d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/CherryPickCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/CherryPickCommand.java
@@ -14,6 +14,8 @@
package com.googlesource.gerrit.plugins.download.command;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.CHERRY_PICK;
+
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.server.config.DownloadConfig;
import com.google.inject.Inject;
@@ -22,7 +24,7 @@
public class CherryPickCommand extends GitDownloadCommand {
@Inject
CherryPickCommand(DownloadConfig downloadConfig) {
- super(downloadConfig, com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.CHERRY_PICK);
+ super(downloadConfig, CHERRY_PICK);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneCommand.java
index 7a67155..1fd3431 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/CloneCommand.java
@@ -14,6 +14,8 @@
package com.googlesource.gerrit.plugins.download.command;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.CHECKOUT;
+
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.server.config.DownloadConfig;
import com.google.inject.Inject;
@@ -22,7 +24,7 @@
public class CloneCommand extends GitDownloadCommand {
@Inject
CloneCommand(DownloadConfig downloadConfig) {
- super(downloadConfig, com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.CHECKOUT);
+ super(downloadConfig, CHECKOUT);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/FormatPatchCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/FormatPatchCommand.java
index a216b32..c02d15a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/FormatPatchCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/FormatPatchCommand.java
@@ -14,6 +14,8 @@
package com.googlesource.gerrit.plugins.download.command;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.FORMAT_PATCH;
+
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.server.config.DownloadConfig;
import com.google.inject.Inject;
@@ -22,7 +24,7 @@
public class FormatPatchCommand extends GitDownloadCommand {
@Inject
FormatPatchCommand(DownloadConfig downloadConfig) {
- super(downloadConfig, com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.FORMAT_PATCH);
+ super(downloadConfig, FORMAT_PATCH);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
index f5a916f..184ed2a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/GitDownloadCommand.java
@@ -14,8 +14,11 @@
package com.googlesource.gerrit.plugins.download.command;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.DEFAULT_DOWNLOADS;
+
import com.google.gerrit.extensions.config.DownloadCommand;
import com.google.gerrit.extensions.config.DownloadScheme;
+import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
import com.google.gerrit.server.config.DownloadConfig;
import com.googlesource.gerrit.plugins.download.scheme.AnonymousGitScheme;
@@ -24,16 +27,14 @@
import com.googlesource.gerrit.plugins.download.scheme.SshScheme;
public abstract class GitDownloadCommand extends DownloadCommand {
- private final com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand cmd;
+ private final AccountGeneralPreferences.DownloadCommand cmd;
private final boolean commandAllowed;
GitDownloadCommand(
- DownloadConfig downloadConfig,
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand cmd) {
+ DownloadConfig downloadConfig, AccountGeneralPreferences.DownloadCommand cmd) {
this.cmd = cmd;
this.commandAllowed = downloadConfig.getDownloadCommands().contains(cmd)
- || downloadConfig.getDownloadCommands().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.DEFAULT_DOWNLOADS);
+ || downloadConfig.getDownloadCommands().contains(DEFAULT_DOWNLOADS);
}
@Override
@@ -51,7 +52,6 @@
}
upperHyphen.append(Character.toUpperCase(words[i].charAt(0))).append(
words[i].substring(1).toLowerCase());
-
}
return upperHyphen.toString();
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/PullCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/PullCommand.java
index b071779..07933f6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/PullCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/PullCommand.java
@@ -14,6 +14,8 @@
package com.googlesource.gerrit.plugins.download.command;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.PULL;
+
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.server.config.DownloadConfig;
import com.google.inject.Inject;
@@ -22,7 +24,7 @@
public class PullCommand extends GitDownloadCommand {
@Inject
PullCommand(DownloadConfig downloadConfig) {
- super(downloadConfig, com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.PULL);
+ super(downloadConfig, PULL);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/command/RepoCommand.java b/src/main/java/com/googlesource/gerrit/plugins/download/command/RepoCommand.java
index 077bac5..d96ab90 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/command/RepoCommand.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/command/RepoCommand.java
@@ -14,6 +14,8 @@
package com.googlesource.gerrit.plugins.download.command;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.REPO_DOWNLOAD;
+
import com.google.common.base.CaseFormat;
import com.google.gerrit.extensions.config.DownloadCommand;
import com.google.gerrit.extensions.config.DownloadScheme;
@@ -27,14 +29,12 @@
@Inject
RepoCommand(DownloadConfig downloadConfig) {
- this.commandAllowed = downloadConfig.getDownloadCommands().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.REPO_DOWNLOAD);
+ this.commandAllowed = downloadConfig.getDownloadCommands().contains(REPO_DOWNLOAD);
}
@Override
public String getName() {
- return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN,
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand.REPO_DOWNLOAD.name());
+ return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, REPO_DOWNLOAD.name());
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousGitScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousGitScheme.java
index ec2533b..4350165 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousGitScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousGitScheme.java
@@ -14,6 +14,9 @@
package com.googlesource.gerrit.plugins.download.scheme;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.ANON_GIT;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.DEFAULT_DOWNLOADS;
+
import com.google.gerrit.extensions.config.DownloadScheme;
import com.google.gerrit.server.config.DownloadConfig;
import com.google.gerrit.server.config.GerritServerConfig;
@@ -31,10 +34,8 @@
DownloadConfig downloadConfig) {
this.gitDaemonUrl =
ensureSlash(cfg.getString("gerrit", null, "canonicalGitUrl"));
- this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.ANON_GIT)
- || downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.DEFAULT_DOWNLOADS);
+ this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(ANON_GIT)
+ || downloadConfig.getDownloadSchemes().contains(DEFAULT_DOWNLOADS);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousHttpScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousHttpScheme.java
index c75ee59..fbb9545 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousHttpScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/AnonymousHttpScheme.java
@@ -14,6 +14,9 @@
package com.googlesource.gerrit.plugins.download.scheme;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.ANON_HTTP;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.DEFAULT_DOWNLOADS;
+
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.config.DownloadScheme;
import com.google.gerrit.server.config.CanonicalWebUrl;
@@ -36,10 +39,8 @@
DownloadConfig downloadConfig) {
this.gitHttpUrl = ensureSlash(cfg.getString("gerrit", null, "gitHttpUrl"));
this.canonicalWebUrl = provider != null ? provider.get() : null;
- this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.ANON_HTTP)
- || downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.DEFAULT_DOWNLOADS);
+ this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(ANON_HTTP)
+ || downloadConfig.getDownloadSchemes().contains(DEFAULT_DOWNLOADS);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
index 6389f80..a69c556 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/HttpScheme.java
@@ -12,9 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-
package com.googlesource.gerrit.plugins.download.scheme;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.DEFAULT_DOWNLOADS;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.HTTP;
+
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.config.DownloadScheme;
import com.google.gerrit.server.config.CanonicalWebUrl;
@@ -37,10 +39,8 @@
DownloadConfig downloadConfig) {
this.gitHttpUrl = ensureSlash(cfg.getString("gerrit", null, "gitHttpUrl"));
this.canonicalWebUrl = provider != null ? provider.get() : null;
- this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.HTTP)
- || downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.DEFAULT_DOWNLOADS);
+ this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(HTTP)
+ || downloadConfig.getDownloadSchemes().contains(DEFAULT_DOWNLOADS);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/RepoScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/RepoScheme.java
index a3fb11d..f6ef690 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/RepoScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/RepoScheme.java
@@ -14,6 +14,8 @@
package com.googlesource.gerrit.plugins.download.scheme;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.REPO_DOWNLOAD;
+
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.extensions.config.DownloadScheme;
import com.google.gerrit.server.config.DownloadConfig;
@@ -26,8 +28,7 @@
@Inject
RepoScheme(DownloadConfig downloadConfig) {
- this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.REPO_DOWNLOAD);
+ this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(REPO_DOWNLOAD);
}
@Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
index 1d4d771..e1db802 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/download/scheme/SshScheme.java
@@ -14,6 +14,9 @@
package com.googlesource.gerrit.plugins.download.scheme;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.DEFAULT_DOWNLOADS;
+import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.SSH;
+
import com.google.gerrit.extensions.annotations.Listen;
import com.google.gerrit.extensions.config.DownloadScheme;
import com.google.gerrit.server.config.DownloadConfig;
@@ -48,10 +51,8 @@
} else {
sshdAddress = null;
}
- this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.SSH)
- || downloadConfig.getDownloadSchemes().contains(
- com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme.DEFAULT_DOWNLOADS);
+ this.schemeAllowed = downloadConfig.getDownloadSchemes().contains(SSH)
+ || downloadConfig.getDownloadSchemes().contains(DEFAULT_DOWNLOADS);
}
@Override