Made all builder properties optional.

This may be detrimental. Most, if not all instances of outfit creation will be done in a controlled manner, so it seems logical this way given the use of futures and optionals.
This commit is contained in:
Aleksei 2020-02-25 15:31:34 -05:00
parent 8d4ec12ea9
commit 93a550ab39
2 changed files with 24 additions and 4 deletions

View File

@ -172,8 +172,8 @@ public class OutfitController {
if (rs.next()) { if (rs.next()) {
count = rs.getInt("count"); count = rs.getInt("count");
} }
FSDB.get().close(rs);
FSDB.get().close(rs);
return count; return count;
} }
@ -184,13 +184,17 @@ public class OutfitController {
if (rs.next()) { if (rs.next()) {
count = rs.getInt("count"); count = rs.getInt("count");
} }
FSDB.get().close(rs);
FSDB.get().close(rs);
return count; return count;
} }
private static Outfit mapObject(ResultSet rs) throws SQLException { private static Outfit mapObject(ResultSet rs) throws SQLException {
return new Outfit.OutfitBuilder(rs.getString("id"), rs.getString("link"), rs.getString("submitter"), rs.getString("tag")) return new Outfit.OutfitBuilder()
.setId(rs.getString("id"))
.setLink(rs.getString("link"))
.setSubmitter(rs.getString("submitter"))
.setTag(rs.getString("tag"))
.setCreated(new Timestamp(rs.getLong("created"))) .setCreated(new Timestamp(rs.getLong("created")))
.setUpdated(new Timestamp((rs.getLong("updated")))) .setUpdated(new Timestamp((rs.getLong("updated"))))
.setDeleted(rs.getBoolean("deleted")) .setDeleted(rs.getBoolean("deleted"))

View File

@ -115,11 +115,27 @@ public class Outfit extends DatabaseModel {
private int displayCount = 0; private int displayCount = 0;
private String deleteHash = ""; private String deleteHash = "";
public OutfitBuilder(String id, String link, String submitter, String tag) { public OutfitBuilder() {
}
public OutfitBuilder setId(String id) {
this.id = id; this.id = id;
return this;
}
public OutfitBuilder setLink(String link) {
this.link = link; this.link = link;
return this;
}
public OutfitBuilder setSubmitter(String submitter) {
this.submitter = submitter; this.submitter = submitter;
return this;
}
public OutfitBuilder setTag(String tag) {
this.tag = tag; this.tag = tag;
return this;
} }
public OutfitBuilder setCreated(Timestamp created) { public OutfitBuilder setCreated(Timestamp created) {