org.postgresql.hostchooser.SingleHostChooser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jdbc-yugabytedb Show documentation
Show all versions of jdbc-yugabytedb Show documentation
Java JDBC 4.2 (JRE 8+) driver for YugaByte SQL database
/*
* Copyright (c) 2014, PostgreSQL Global Development Group
* See the LICENSE file in the project root for more information.
*/
package org.postgresql.hostchooser;
import org.postgresql.util.HostSpec;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
/**
* Host chooser that returns the single host.
*/
class SingleHostChooser implements HostChooser {
private final Collection candidateHost;
SingleHostChooser(HostSpec hostSpec, HostRequirement targetServerType) {
this.candidateHost = Collections.singletonList(new CandidateHost(hostSpec, targetServerType));
}
@Override
public Iterator iterator() {
return candidateHost.iterator();
}
}