tech.ydb.jdbc.settings.YdbConnectionProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ydb-jdbc-driver Show documentation
Show all versions of ydb-jdbc-driver Show documentation
JDBC Driver over YDB Java SDK
package tech.ydb.jdbc.settings;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Nullable;
import tech.ydb.core.auth.StaticCredentials;
public class YdbConnectionProperties {
private final String safeURL;
private final String connectionString;
private final String username;
private final String password;
private final Map, ParsedProperty> params;
public YdbConnectionProperties(String safeURL, String connectionString, String username, String password,
Map, ParsedProperty> params) {
this.safeURL = safeURL;
this.connectionString = Objects.requireNonNull(connectionString);
this.username = username;
this.password = password;
this.params = Objects.requireNonNull(params);
}
public String getSafeUrl() {
return safeURL;
}
public String getConnectionString() {
return connectionString;
}
@Nullable
public ParsedProperty getProperty(YdbConnectionProperty> property) {
return params.get(property);
}
public Map, ParsedProperty> getParams() {
return params;
}
public boolean hasStaticCredentials() {
return username != null && !username.isEmpty();
}
public StaticCredentials getStaticCredentials() {
return new StaticCredentials(username, password);
}
}