From e7b5a422defa8766377a058b8eedf2e56803a160 Mon Sep 17 00:00:00 2001 From: mathias Date: Mon, 30 Aug 2021 12:29:54 +0200 Subject: [PATCH] Cleaned up code --- .../sqltoolkit/generator/TableGenerator.java | 11 +++++----- .../manager/ConnectSettingsManager.java | 20 +++++++++++++++++-- .../queries/TableCreationQuery.java | 4 +++- .../de/gnmyt/sqltoolkit/types/TableField.java | 1 + 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/gnmyt/sqltoolkit/generator/TableGenerator.java b/src/main/java/de/gnmyt/sqltoolkit/generator/TableGenerator.java index 05c65ee..c7c1c7d 100644 --- a/src/main/java/de/gnmyt/sqltoolkit/generator/TableGenerator.java +++ b/src/main/java/de/gnmyt/sqltoolkit/generator/TableGenerator.java @@ -30,11 +30,11 @@ public class TableGenerator { /** * Add a field to the Table * - * @param type The type of the field you want to add - * @param name The name of the field you want to add - * @param length The length of the field you want to add - * @param defaultValue The default value of the field (leave empty for no default value) - * @param extras Optional parameters you want to add to the statement + * @param type The type of the field you want to add + * @param name The name of the field you want to add + * @param length The length of the field you want to add + * @param defaultValue The default value of the field (leave empty for no default value) + * @param extras Optional parameters you want to add to the statement * @return this class */ public TableGenerator addField(SQLType type, String name, Integer length, String defaultValue, String... extras) { @@ -56,6 +56,7 @@ public class TableGenerator { /** * Add a field to the table + * * @param field The field you want to add * @return this class */ diff --git a/src/main/java/de/gnmyt/sqltoolkit/manager/ConnectSettingsManager.java b/src/main/java/de/gnmyt/sqltoolkit/manager/ConnectSettingsManager.java index db5b755..8a2cdac 100644 --- a/src/main/java/de/gnmyt/sqltoolkit/manager/ConnectSettingsManager.java +++ b/src/main/java/de/gnmyt/sqltoolkit/manager/ConnectSettingsManager.java @@ -9,7 +9,7 @@ public class ConnectSettingsManager { private final MySQLConnection connection; - private HashMap settingValues = new HashMap<>(); + private final HashMap settingValues = new HashMap<>(); public ConnectSettingsManager(MySQLConnection connection) { this.connection = connection; @@ -17,8 +17,9 @@ public class ConnectSettingsManager { /** * Adds a custom property to the values + * * @param property The property you want to add - * @param value The value you want to use + * @param value The value you want to use * @return this class */ public ConnectSettingsManager customProperty(String property, Object value) { @@ -29,6 +30,7 @@ public class ConnectSettingsManager { /** * Sets the timezone of the connection + * * @param timezone The new timezone * @return this class */ @@ -40,6 +42,7 @@ public class ConnectSettingsManager { /** * Sets the requireSSL property + * * @param requireSSL The new value of the requireSSL property * @return this class */ @@ -50,6 +53,7 @@ public class ConnectSettingsManager { /** * Sets the useSSL property + * * @param useSSL The new value of the useSSL property * @return this class */ @@ -60,6 +64,7 @@ public class ConnectSettingsManager { /** * Sets the autoReconnect property + * * @param autoReconnect The new value of the autoReconnect property * @return this class */ @@ -70,6 +75,7 @@ public class ConnectSettingsManager { /** * Sets the maxReconnects property + * * @param maxReconnects The new value of the maxReconnects property * @return this class */ @@ -80,6 +86,7 @@ public class ConnectSettingsManager { /** * Sets the charset property + * * @param charset The new value of the charset property * @return this class */ @@ -90,6 +97,7 @@ public class ConnectSettingsManager { /** * Sets the tcpKeepAlive property + * * @param tcpKeepAlive The new value of the tcpKeepAlive property * @return this class */ @@ -100,6 +108,7 @@ public class ConnectSettingsManager { /** * Sets the tcpNoDelay property + * * @param tcpNoDelay The new value of the tcpNoDelay property * @return this class */ @@ -110,6 +119,7 @@ public class ConnectSettingsManager { /** * Sets the tcpRcvBuf property + * * @param tcpRcvBuf The new value of the tcpRcvBuf property * @return this class */ @@ -120,6 +130,7 @@ public class ConnectSettingsManager { /** * Sets the tcpSndBuf property + * * @param tcpSndBuf The new value of the tcpSndBuf property * @return this class */ @@ -130,6 +141,7 @@ public class ConnectSettingsManager { /** * Sets the tcpTrafficClass property + * * @param tcpTrafficClass The new value of the tcpTrafficClass property * @return this class */ @@ -140,6 +152,7 @@ public class ConnectSettingsManager { /** * Sets the useCompression property + * * @param useCompression The new value of the useCompression property * @return this class */ @@ -150,6 +163,7 @@ public class ConnectSettingsManager { /** * Sets the useUnbufferedInput property + * * @param useUnbufferedInput The new value of the useUnbufferedInput property * @return this class */ @@ -160,6 +174,7 @@ public class ConnectSettingsManager { /** * Sets the paranoid property + * * @param paranoid The new value of the paranoid property * @return this class */ @@ -170,6 +185,7 @@ public class ConnectSettingsManager { /** * Creates the connection string + * * @return the connection string */ public String generateConnectionString() { diff --git a/src/main/java/de/gnmyt/sqltoolkit/queries/TableCreationQuery.java b/src/main/java/de/gnmyt/sqltoolkit/queries/TableCreationQuery.java index 84371f5..2eec247 100644 --- a/src/main/java/de/gnmyt/sqltoolkit/queries/TableCreationQuery.java +++ b/src/main/java/de/gnmyt/sqltoolkit/queries/TableCreationQuery.java @@ -21,6 +21,7 @@ public class TableCreationQuery extends AbstractQuery { /** * Builds the field list + * * @return the field list as a string */ public String buildFieldList() { @@ -33,7 +34,8 @@ public class TableCreationQuery extends AbstractQuery { builder.append(fieldList.get(i).generateSQLRow()); } - if (!((String) getParameter(PRIMARY_KEY)).isEmpty()) builder.appendDefault(String.format(", PRIMARY KEY (%s)", getParameter(PRIMARY_KEY))); + if (!((String) getParameter(PRIMARY_KEY)).isEmpty()) + builder.appendDefault(String.format(", PRIMARY KEY (%s)", getParameter(PRIMARY_KEY))); return builder.append(")").build(); } diff --git a/src/main/java/de/gnmyt/sqltoolkit/types/TableField.java b/src/main/java/de/gnmyt/sqltoolkit/types/TableField.java index aef35b3..fab06d8 100644 --- a/src/main/java/de/gnmyt/sqltoolkit/types/TableField.java +++ b/src/main/java/de/gnmyt/sqltoolkit/types/TableField.java @@ -127,6 +127,7 @@ public class TableField { /** * Sets the extras of the field + * * @param extras The extras you want to add * @return this class */