Cleaned up code
This commit is contained in:
parent
a207aca196
commit
e7b5a422de
@ -30,11 +30,11 @@ public class TableGenerator {
|
|||||||
/**
|
/**
|
||||||
* Add a field to the Table
|
* Add a field to the Table
|
||||||
*
|
*
|
||||||
* @param type The type of the field you want to add
|
* @param type The type of the field you want to add
|
||||||
* @param name The name 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 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 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 extras Optional parameters you want to add to the statement
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
public TableGenerator addField(SQLType type, String name, Integer length, String defaultValue, String... extras) {
|
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
|
* Add a field to the table
|
||||||
|
*
|
||||||
* @param field The field you want to add
|
* @param field The field you want to add
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
|
@ -9,7 +9,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
private final MySQLConnection connection;
|
private final MySQLConnection connection;
|
||||||
|
|
||||||
private HashMap<String, Object> settingValues = new HashMap<>();
|
private final HashMap<String, Object> settingValues = new HashMap<>();
|
||||||
|
|
||||||
public ConnectSettingsManager(MySQLConnection connection) {
|
public ConnectSettingsManager(MySQLConnection connection) {
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
@ -17,8 +17,9 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a custom property to the values
|
* Adds a custom property to the values
|
||||||
|
*
|
||||||
* @param property The property you want to add
|
* @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
|
* @return this class
|
||||||
*/
|
*/
|
||||||
public ConnectSettingsManager customProperty(String property, Object value) {
|
public ConnectSettingsManager customProperty(String property, Object value) {
|
||||||
@ -29,6 +30,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the timezone of the connection
|
* Sets the timezone of the connection
|
||||||
|
*
|
||||||
* @param timezone The new timezone
|
* @param timezone The new timezone
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -40,6 +42,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the requireSSL property
|
* Sets the requireSSL property
|
||||||
|
*
|
||||||
* @param requireSSL The new value of the requireSSL property
|
* @param requireSSL The new value of the requireSSL property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -50,6 +53,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the useSSL property
|
* Sets the useSSL property
|
||||||
|
*
|
||||||
* @param useSSL The new value of the useSSL property
|
* @param useSSL The new value of the useSSL property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -60,6 +64,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the autoReconnect property
|
* Sets the autoReconnect property
|
||||||
|
*
|
||||||
* @param autoReconnect The new value of the autoReconnect property
|
* @param autoReconnect The new value of the autoReconnect property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -70,6 +75,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maxReconnects property
|
* Sets the maxReconnects property
|
||||||
|
*
|
||||||
* @param maxReconnects The new value of the maxReconnects property
|
* @param maxReconnects The new value of the maxReconnects property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -80,6 +86,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the charset property
|
* Sets the charset property
|
||||||
|
*
|
||||||
* @param charset The new value of the charset property
|
* @param charset The new value of the charset property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -90,6 +97,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tcpKeepAlive property
|
* Sets the tcpKeepAlive property
|
||||||
|
*
|
||||||
* @param tcpKeepAlive The new value of the tcpKeepAlive property
|
* @param tcpKeepAlive The new value of the tcpKeepAlive property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -100,6 +108,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tcpNoDelay property
|
* Sets the tcpNoDelay property
|
||||||
|
*
|
||||||
* @param tcpNoDelay The new value of the tcpNoDelay property
|
* @param tcpNoDelay The new value of the tcpNoDelay property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -110,6 +119,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tcpRcvBuf property
|
* Sets the tcpRcvBuf property
|
||||||
|
*
|
||||||
* @param tcpRcvBuf The new value of the tcpRcvBuf property
|
* @param tcpRcvBuf The new value of the tcpRcvBuf property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -120,6 +130,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tcpSndBuf property
|
* Sets the tcpSndBuf property
|
||||||
|
*
|
||||||
* @param tcpSndBuf The new value of the tcpSndBuf property
|
* @param tcpSndBuf The new value of the tcpSndBuf property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -130,6 +141,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tcpTrafficClass property
|
* Sets the tcpTrafficClass property
|
||||||
|
*
|
||||||
* @param tcpTrafficClass The new value of the tcpTrafficClass property
|
* @param tcpTrafficClass The new value of the tcpTrafficClass property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -140,6 +152,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the useCompression property
|
* Sets the useCompression property
|
||||||
|
*
|
||||||
* @param useCompression The new value of the useCompression property
|
* @param useCompression The new value of the useCompression property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -150,6 +163,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the useUnbufferedInput property
|
* Sets the useUnbufferedInput property
|
||||||
|
*
|
||||||
* @param useUnbufferedInput The new value of the useUnbufferedInput property
|
* @param useUnbufferedInput The new value of the useUnbufferedInput property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -160,6 +174,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the paranoid property
|
* Sets the paranoid property
|
||||||
|
*
|
||||||
* @param paranoid The new value of the paranoid property
|
* @param paranoid The new value of the paranoid property
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
@ -170,6 +185,7 @@ public class ConnectSettingsManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the connection string
|
* Creates the connection string
|
||||||
|
*
|
||||||
* @return the connection string
|
* @return the connection string
|
||||||
*/
|
*/
|
||||||
public String generateConnectionString() {
|
public String generateConnectionString() {
|
||||||
|
@ -21,6 +21,7 @@ public class TableCreationQuery extends AbstractQuery {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the field list
|
* Builds the field list
|
||||||
|
*
|
||||||
* @return the field list as a string
|
* @return the field list as a string
|
||||||
*/
|
*/
|
||||||
public String buildFieldList() {
|
public String buildFieldList() {
|
||||||
@ -33,7 +34,8 @@ public class TableCreationQuery extends AbstractQuery {
|
|||||||
builder.append(fieldList.get(i).generateSQLRow());
|
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();
|
return builder.append(")").build();
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,7 @@ public class TableField {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the extras of the field
|
* Sets the extras of the field
|
||||||
|
*
|
||||||
* @param extras The extras you want to add
|
* @param extras The extras you want to add
|
||||||
* @return this class
|
* @return this class
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user