Skip to content

Commit

Permalink
Use collection for credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
pfeuffer committed May 17, 2021
1 parent 37d2e1b commit 2a083cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Expand Up @@ -32,7 +32,7 @@
import sonia.scm.repository.spi.MirrorCommandRequest;

import java.util.ArrayList;
import java.util.List;
import java.util.Collection;

import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
Expand All @@ -48,7 +48,7 @@ public final class MirrorCommandBuilder {
private final Repository targetRepository;

private String sourceUrl;
private List<Credential> credentials = emptyList();
private Collection<Credential> credentials = emptyList();

MirrorCommandBuilder(MirrorCommand mirrorCommand, Repository targetRepository) {
this.mirrorCommand = mirrorCommand;
Expand All @@ -62,7 +62,7 @@ public MirrorCommandBuilder setCredentials(Credential credential, Credential...
return this;
}

public MirrorCommandBuilder setCredentials(List<Credential> credentials) {
public MirrorCommandBuilder setCredentials(Collection<Credential> credentials) {
this.credentials = credentials;
return this;
}
Expand Down
Expand Up @@ -27,19 +27,19 @@
import org.apache.commons.lang.StringUtils;
import sonia.scm.repository.api.Credential;

import java.util.List;
import java.util.Collection;
import java.util.Optional;

import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableList;
import static java.util.Collections.unmodifiableCollection;

/**
* @since 2.19.0
*/
public final class MirrorCommandRequest {

private String sourceUrl;
private List<Credential> credentials = emptyList();
private Collection<Credential> credentials = emptyList();

public String getSourceUrl() {
return sourceUrl;
Expand All @@ -49,8 +49,8 @@ public void setSourceUrl(String sourceUrl) {
this.sourceUrl = sourceUrl;
}

public List<Credential> getCredentials() {
return unmodifiableList(credentials);
public Collection<Credential> getCredentials() {
return unmodifiableCollection(credentials);
}

public <T extends Credential> Optional<T> getCredential(Class<T> credentialClass) {
Expand All @@ -61,7 +61,7 @@ public <T extends Credential> Optional<T> getCredential(Class<T> credentialClass
.findFirst();
}

public void setCredentials(List<Credential> credentials) {
public void setCredentials(Collection<Credential> credentials) {
this.credentials = credentials;
}

Expand Down

0 comments on commit 2a083cf

Please sign in to comment.