Package betterBankingGUImaven
Class Utilities
Object
Utilities
public class Utilities
extends Object
This class implements various recurring utilities for the BetterBanking software.
- Version:
- 1.0
- Author:
- Tristan Parry
-
Constructor Summary
Constructors Constructor Description Utilities()
-
Method Summary
Modifier and Type Method Description static MongoDatabase
connectToMongoDB()
This method connects to/returns the BetterBanking MongoDB database (MongoDatabase) on the BetterBanking hosted cluster (MongoDB Atlas)static double
readDoubleFrom(JTextField fieldArg)
This method reads from a user's input, and effectively returns a formatted double for use in Account methods.static void
writeToDatabase(String collection, Document updateDoc, String key, Object value)
This method reads from the BetterBanking database, and rewrites specified lines from the MongoDB database.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Utilities
public Utilities()
-
-
Method Details
-
writeToDatabase
public static void writeToDatabase(String collection, Document updateDoc, String key, Object value)This method reads from the BetterBanking database, and rewrites specified lines from the MongoDB database.- Parameters:
collection
- Collection parsed from the MongoDB internal databaseupdateDoc
- MongoDB Document to updatekey
- String key to update in the MongoDB Documentvalue
- String value to update in the MongoDB Document
-
readDoubleFrom
public static double readDoubleFrom(JTextField fieldArg)This method reads from a user's input, and effectively returns a formatted double for use in Account methods.- Parameters:
stringArg
- String to read a user's monetary input- Returns:
- A formatted double to be used in BetterBanking Account methods
-
connectToMongoDB
public static MongoDatabase connectToMongoDB()This method connects to/returns the BetterBanking MongoDB database (MongoDatabase) on the BetterBanking hosted cluster (MongoDB Atlas)- Returns:
- The MongoDB BetterBanking database
-