From 4901e6359909afad7325535fca79218c48e8bc8b Mon Sep 17 00:00:00 2001 From: Colin McDonald Date: Fri, 24 Jun 2016 19:00:40 -0400 Subject: [PATCH] Change Jackson constructors from public to private --- src/main/java/net/frozenorb/apiv3/APIv3.java | 2 -- src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCity.java | 2 +- src/main/java/net/frozenorb/apiv3/maxmind/MaxMindContinent.java | 2 +- src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCountry.java | 2 +- src/main/java/net/frozenorb/apiv3/maxmind/MaxMindLocation.java | 2 +- src/main/java/net/frozenorb/apiv3/maxmind/MaxMindPostal.java | 2 +- .../net/frozenorb/apiv3/maxmind/MaxMindRegisteredCountry.java | 2 +- src/main/java/net/frozenorb/apiv3/maxmind/MaxMindResult.java | 2 +- .../java/net/frozenorb/apiv3/maxmind/MaxMindSubdivision.java | 2 +- src/main/java/net/frozenorb/apiv3/maxmind/MaxMindTraits.java | 2 +- src/main/java/net/frozenorb/apiv3/model/AuditLogEntry.java | 2 +- src/main/java/net/frozenorb/apiv3/model/Grant.java | 2 +- src/main/java/net/frozenorb/apiv3/model/IpBan.java | 2 +- src/main/java/net/frozenorb/apiv3/model/IpIntel.java | 2 +- src/main/java/net/frozenorb/apiv3/model/IpLogEntry.java | 2 +- .../java/net/frozenorb/apiv3/model/NotificationTemplate.java | 2 +- src/main/java/net/frozenorb/apiv3/model/Punishment.java | 2 +- src/main/java/net/frozenorb/apiv3/model/Rank.java | 2 +- src/main/java/net/frozenorb/apiv3/model/Server.java | 2 +- src/main/java/net/frozenorb/apiv3/model/ServerGroup.java | 2 +- 20 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/main/java/net/frozenorb/apiv3/APIv3.java b/src/main/java/net/frozenorb/apiv3/APIv3.java index 039085e..87a1691 100644 --- a/src/main/java/net/frozenorb/apiv3/APIv3.java +++ b/src/main/java/net/frozenorb/apiv3/APIv3.java @@ -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); } diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCity.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCity.java index 06986e6..b2fb39c 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCity.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCity.java @@ -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); diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindContinent.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindContinent.java index 0243d55..8682a05 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindContinent.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindContinent.java @@ -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", ""); diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCountry.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCountry.java index 29ade9f..52427b9 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCountry.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindCountry.java @@ -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", ""); diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindLocation.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindLocation.java index 5ff57ef..7d40c5f 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindLocation.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindLocation.java @@ -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); diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindPostal.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindPostal.java index a3bef02..da1cbfe 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindPostal.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindPostal.java @@ -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", ""); diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindRegisteredCountry.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindRegisteredCountry.java index 6770677..31949a6 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindRegisteredCountry.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindRegisteredCountry.java @@ -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", ""); diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindResult.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindResult.java index c4906ce..d42c65b 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindResult.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindResult.java @@ -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())); diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindSubdivision.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindSubdivision.java index 05948c9..94f6738 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindSubdivision.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindSubdivision.java @@ -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", ""); diff --git a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindTraits.java b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindTraits.java index 0193f4b..a019c4f 100644 --- a/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindTraits.java +++ b/src/main/java/net/frozenorb/apiv3/maxmind/MaxMindTraits.java @@ -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", ""); diff --git a/src/main/java/net/frozenorb/apiv3/model/AuditLogEntry.java b/src/main/java/net/frozenorb/apiv3/model/AuditLogEntry.java index 923bb73..1f1ceb7 100644 --- a/src/main/java/net/frozenorb/apiv3/model/AuditLogEntry.java +++ b/src/main/java/net/frozenorb/apiv3/model/AuditLogEntry.java @@ -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 metadata) { this.id = new ObjectId().toString(); diff --git a/src/main/java/net/frozenorb/apiv3/model/Grant.java b/src/main/java/net/frozenorb/apiv3/model/Grant.java index 5349603..9d457a0 100644 --- a/src/main/java/net/frozenorb/apiv3/model/Grant.java +++ b/src/main/java/net/frozenorb/apiv3/model/Grant.java @@ -81,7 +81,7 @@ public final class Grant { }); } - public Grant() {} // For Jackson + private Grant() {} // For Jackson public Grant(User user, String reason, Set scopes, Rank rank, Instant expiresAt, User addedBy) { this.id = new ObjectId().toString(); diff --git a/src/main/java/net/frozenorb/apiv3/model/IpBan.java b/src/main/java/net/frozenorb/apiv3/model/IpBan.java index 0f39cdc..6cda46d 100644 --- a/src/main/java/net/frozenorb/apiv3/model/IpBan.java +++ b/src/main/java/net/frozenorb/apiv3/model/IpBan.java @@ -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(); diff --git a/src/main/java/net/frozenorb/apiv3/model/IpIntel.java b/src/main/java/net/frozenorb/apiv3/model/IpIntel.java index e7b39aa..4e83b16 100644 --- a/src/main/java/net/frozenorb/apiv3/model/IpIntel.java +++ b/src/main/java/net/frozenorb/apiv3/model/IpIntel.java @@ -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; diff --git a/src/main/java/net/frozenorb/apiv3/model/IpLogEntry.java b/src/main/java/net/frozenorb/apiv3/model/IpLogEntry.java index ea25f3f..9737717 100644 --- a/src/main/java/net/frozenorb/apiv3/model/IpLogEntry.java +++ b/src/main/java/net/frozenorb/apiv3/model/IpLogEntry.java @@ -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(); diff --git a/src/main/java/net/frozenorb/apiv3/model/NotificationTemplate.java b/src/main/java/net/frozenorb/apiv3/model/NotificationTemplate.java index 8116929..168e1b1 100644 --- a/src/main/java/net/frozenorb/apiv3/model/NotificationTemplate.java +++ b/src/main/java/net/frozenorb/apiv3/model/NotificationTemplate.java @@ -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; diff --git a/src/main/java/net/frozenorb/apiv3/model/Punishment.java b/src/main/java/net/frozenorb/apiv3/model/Punishment.java index 95f6511..1f1f055 100644 --- a/src/main/java/net/frozenorb/apiv3/model/Punishment.java +++ b/src/main/java/net/frozenorb/apiv3/model/Punishment.java @@ -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 metadata) { this.id = new ObjectId().toString(); diff --git a/src/main/java/net/frozenorb/apiv3/model/Rank.java b/src/main/java/net/frozenorb/apiv3/model/Rank.java index efecedd..8aeecb7 100644 --- a/src/main/java/net/frozenorb/apiv3/model/Rank.java +++ b/src/main/java/net/frozenorb/apiv3/model/Rank.java @@ -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; diff --git a/src/main/java/net/frozenorb/apiv3/model/Server.java b/src/main/java/net/frozenorb/apiv3/model/Server.java index 53a30d4..ea6a072 100644 --- a/src/main/java/net/frozenorb/apiv3/model/Server.java +++ b/src/main/java/net/frozenorb/apiv3/model/Server.java @@ -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; diff --git a/src/main/java/net/frozenorb/apiv3/model/ServerGroup.java b/src/main/java/net/frozenorb/apiv3/model/ServerGroup.java index 54a80b3..f1b286a 100644 --- a/src/main/java/net/frozenorb/apiv3/model/ServerGroup.java +++ b/src/main/java/net/frozenorb/apiv3/model/ServerGroup.java @@ -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;