Skip to content

Commit

Permalink
Simple source builder implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Daligz committed May 21, 2022
1 parent 621b73f commit 69071ea
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.royalmind.library.lightquery</groupId>
<artifactId>LightQuery</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>

<distributionManagement>
<repository>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package me.upp.daligz.p3.backend.modelo;

import com.zaxxer.hikari.HikariConfig;

public class SimpleSourceBuilder {

private String url = "", user = "", password = "";

public me.upp.daligz.p3.backend.modelo.SimpleSourceBuilder setUlr(final String url) {
this.url = url;
return this;
}

public me.upp.daligz.p3.backend.modelo.SimpleSourceBuilder setUser(final String user) {
this.user = user;
return this;
}

public me.upp.daligz.p3.backend.modelo.SimpleSourceBuilder setPassword(final String password) {
this.password = password;
return this;
}

public HikariConfig build() {
if (this.url.isEmpty() || this.user.isEmpty()) return null;
final HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setJdbcUrl(this.url);
hikariConfig.setUsername(this.user);
hikariConfig.setPassword(this.password);
hikariConfig.addDataSourceProperty("cachePrepStmts", true);
hikariConfig.addDataSourceProperty("prepStmtCacheSize", 250);
hikariConfig.addDataSourceProperty("prepStmtCacheSqlLimit", 2048);
return hikariConfig;
}
}

0 comments on commit 69071ea

Please sign in to comment.