From 83d3eb4874c1325717fbf39047564868501efa59 Mon Sep 17 00:00:00 2001 From: George V Date: Mon, 17 Apr 2023 16:52:35 +0300 Subject: [PATCH] feat(UserManager): Update constructor for storage systems This commit updates the `UserManager` class constructor. The previous constructor was refactored to remove the multiple if-else statements for type checking and replaced with a `switch` statement. Additionally, the new constructor adds fields for `File directory` , `Connection conn`, and `MongoDB db`, depending on the storage type. This allows for more flexibility and easier maintenance of the class. Finally, the `usersDirectory` field is now created if it does not exist. This change is a feature addition and improves the class's usability. --- .../java/com/georgev22/library/utilities/UserManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/src/main/java/com/georgev22/library/utilities/UserManager.java b/database/src/main/java/com/georgev22/library/utilities/UserManager.java index 24b276a..1d1a77c 100644 --- a/database/src/main/java/com/georgev22/library/utilities/UserManager.java +++ b/database/src/main/java/com/georgev22/library/utilities/UserManager.java @@ -51,7 +51,7 @@ public class UserManager { * * @param type the type of storage system to be used (JSON, SQL or MONGODB) * @param obj the object to be used for storage (File for JSON, Connection for SQL and MongoDB for MONGODB) - * @param collectionName the name of the collection to be used for MONGODB, null for other types + * @param collectionName the name of the collection to be used for MONGODB and SQL, null for other types */ public UserManager(@NotNull Type type, Object obj, @Nullable String collectionName) { this.type = type; @@ -93,7 +93,7 @@ public UserManager registerObjectMapSerializer() { } /** - * Registers type adapters for the specified classes using the GsonBuilder. + * Register type adapters for the specified classes using the GsonBuilder. * * @param pairs a PairDocument containing the Class and type adapter pairs to register * @return this UserManager