Change Jackson constructors from public to private

This commit is contained in:
Colin McDonald 2016-06-24 19:00:40 -04:00
parent 1c07b20f89
commit 4901e63599
20 changed files with 19 additions and 21 deletions

View File

@ -309,8 +309,6 @@ public final class APIv3 extends AbstractVerticle {
webServer.requestHandler(http::accept).listen(port);
}
// TODO: TEST IF OUR MODEL CONSTRUCTORS CAN BE PRIVATE
public static void respondJson(RoutingContext ctx, Object response) {
respondJson(ctx, 200, response);
}

View File

@ -10,7 +10,7 @@ public final class MaxMindCity {
@Getter private int geonameId;
@Getter private String name;
public MaxMindCity() {} // For Jackson
private MaxMindCity() {} // For Jackson
public MaxMindCity(JsonObject legacy) {
this.confidence = legacy.getInteger("confidence", -1);

View File

@ -10,7 +10,7 @@ public final class MaxMindContinent {
@Getter private int geonameId;
@Getter private String name;
public MaxMindContinent() {} // For Jackson
private MaxMindContinent() {} // For Jackson
public MaxMindContinent(JsonObject legacy) {
this.code = legacy.getString("code", "");

View File

@ -11,7 +11,7 @@ public final class MaxMindCountry {
@Getter private int geonameId;
@Getter private String name;
public MaxMindCountry() {} // For Jackson
private MaxMindCountry() {} // For Jackson
public MaxMindCountry(JsonObject legacy) {
this.isoCode = legacy.getString("iso_code", "");

View File

@ -13,7 +13,7 @@ public final class MaxMindLocation {
@Getter private int metroCode;
@Getter private int averageIncome;
public MaxMindLocation() {} // For Jackson
private MaxMindLocation() {} // For Jackson
public MaxMindLocation(JsonObject legacy) {
this.latitude = legacy.getDouble("latitude", -1D);

View File

@ -8,7 +8,7 @@ public final class MaxMindPostal {
@Getter private String code;
@Getter private int confidence;
public MaxMindPostal() {} // For Jackson
private MaxMindPostal() {} // For Jackson
public MaxMindPostal(JsonObject legacy) {
this.code = legacy.getString("code", "");

View File

@ -10,7 +10,7 @@ public final class MaxMindRegisteredCountry {
@Getter private int geonameId;
@Getter private String name;
public MaxMindRegisteredCountry() {} // For Jackson
private MaxMindRegisteredCountry() {} // For Jackson
public MaxMindRegisteredCountry(JsonObject legacy) {
this.isoCode = legacy.getString("iso_code", "");

View File

@ -19,7 +19,7 @@ public final class MaxMindResult {
@Getter private MaxMindCountry country;
@Getter private MaxMindRegisteredCountry registeredCountry;
public MaxMindResult() {} // For Jackson
private MaxMindResult() {} // For Jackson
public MaxMindResult(JsonObject legacy) {
this.continent = new MaxMindContinent(legacy.getJsonObject("continent", new JsonObject()));

View File

@ -11,7 +11,7 @@ public final class MaxMindSubdivision {
@Getter private int geonameId;
@Getter private String name;
public MaxMindSubdivision() {} // For Jackson
private MaxMindSubdivision() {} // For Jackson
public MaxMindSubdivision(JsonObject legacy) {
this.isoCode = legacy.getString("iso_code", "");

View File

@ -12,7 +12,7 @@ public final class MaxMindTraits {
@Getter private MaxMindUserType userType;
@Getter private String organization;
public MaxMindTraits() {} // For Jackson
private MaxMindTraits() {} // For Jackson
public MaxMindTraits(JsonObject legacy) {
this.isp = legacy.getString("isp", "");

View File

@ -41,7 +41,7 @@ public final class AuditLogEntry {
auditLogCollection.find(query).into(new LinkedList<>(), callback);
}
public AuditLogEntry() {} // For Jackson
private AuditLogEntry() {} // For Jackson
public AuditLogEntry(User user, String userIp, Actor actor, AuditLogActionType type, Map<String, Object> metadata) {
this.id = new ObjectId().toString();

View File

@ -81,7 +81,7 @@ public final class Grant {
});
}
public Grant() {} // For Jackson
private Grant() {} // For Jackson
public Grant(User user, String reason, Set<ServerGroup> scopes, Rank rank, Instant expiresAt, User addedBy) {
this.id = new ObjectId().toString();

View File

@ -69,7 +69,7 @@ public final class IpBan {
});
}
public IpBan() {} // For Jackson
private IpBan() {} // For Jackson
public IpBan(String userIp, Punishment linked) {
this.id = new ObjectId().toString();

View File

@ -59,7 +59,7 @@ public final class IpIntel {
});
}
public IpIntel() {} // For Jackson
private IpIntel() {} // For Jackson
private IpIntel(String ip, MaxMindResult result) {
this.id = ip;

View File

@ -53,7 +53,7 @@ public final class IpLogEntry {
ipLogCollection.find(new Document("user", user).append("userIp", userIp)).first(callback);
}
public IpLogEntry() {} // For Jackson
private IpLogEntry() {} // For Jackson
public IpLogEntry(User user, String userIp) {
this.id = new ObjectId().toString();

View File

@ -31,7 +31,7 @@ public final class NotificationTemplate {
notificationTemplatesCollection.find(new Document("_id", id)).first(callback);
}
public NotificationTemplate() {} // For Jackson
private NotificationTemplate() {} // For Jackson
public NotificationTemplate(String id, String subject, String body) {
this.id = id;

View File

@ -95,7 +95,7 @@ public final class Punishment {
punishmentsCollection.find(new Document("user", user).append("type", new Document("$in", convertedTypes))).into(new LinkedList<>(), callback);
}
public Punishment() {} // For Jackson
private Punishment() {} // For Jackson
public Punishment(User user, String reason, PunishmentType type, Instant expiresAt, User addedBy, Actor actor, Map<String, Object> metadata) {
this.id = new ObjectId().toString();

View File

@ -66,7 +66,7 @@ public final class Rank {
});
}
public Rank() {} // For Jackson
private Rank() {} // For Jackson
public Rank(String id, int weight, String displayName, String gameColor, String websiteColor, boolean staffRank) {
this.id = id;

View File

@ -69,7 +69,7 @@ public final class Server {
});
}
public Server() {} // For Jackson
private Server() {} // For Jackson
public Server(String id, String displayName, String apiKey, ServerGroup serverGroup, String serverIp) {
this.id = id;

View File

@ -65,7 +65,7 @@ public final class ServerGroup {
});
}
public ServerGroup() {} // For Jackson
private ServerGroup() {} // For Jackson
public ServerGroup(String id, String image) {
this.id = id;