Skip to content

Commit

Permalink
net-sf-ucanaccess-fork: Updates for code style
Browse files Browse the repository at this point in the history
  • Loading branch information
spannm committed Feb 2, 2024
1 parent c58d274 commit 77ffbe5
Show file tree
Hide file tree
Showing 40 changed files with 291 additions and 302 deletions.
10 changes: 5 additions & 5 deletions src/main/java/net/ucanaccess/commands/CompositeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import java.util.*;

public class CompositeCommand implements ICommand {
private List<ICursorCommand> composite = new ArrayList<>();
private Map<String, Object> currentRow;
private String execId;
private IndexSelector indexSelector;
private List<ICursorCommand> rollbackCache = new ArrayList<>();
private final List<ICursorCommand> composite = new ArrayList<>();
private Map<String, Object> currentRow;
private String execId;
private IndexSelector indexSelector;
private final List<ICursorCommand> rollbackCache = new ArrayList<>();

public boolean add(ICursorCommand c4io) {
if (indexSelector == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

public class CreateForeignKeyCommand implements ICommand {

private String tableName;
private String referencedTable;
private String execId;
private String relationshipName;
private final String tableName;
private final String referencedTable;
private final String execId;
private final String relationshipName;

public CreateForeignKeyCommand(String _tableName, String _referencedTable, String _execId, String _relationshipName) {
tableName = _tableName;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/ucanaccess/commands/CreateIndexCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import java.sql.SQLException;

public class CreateIndexCommand implements ICommand {
private String indexName;
private String tableName;
private String execId;
private final String indexName;
private final String tableName;
private final String execId;

public CreateIndexCommand(String _indexName, String _tableName, String _execId) {
indexName = _indexName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.sql.SQLException;

public class CreatePrimaryKeyCommand implements ICommand {
private String tableName;
private String execId;
private final String tableName;
private final String execId;

public CreatePrimaryKeyCommand(String _tableName, String _execId) {
tableName = _tableName;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/ucanaccess/commands/CreateTableCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import java.util.Objects;

public class CreateTableCommand implements ICommand {
private String execId;
private String tableName;
private final String execId;
private final String tableName;
private String[] types;
private String[] defaults;
private Boolean[] notNulls;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/ucanaccess/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import java.util.Map;

public class DeleteCommand extends AbstractCursorCommand {
private String execId;
private IndexSelector indexSelector;
private Map<String, Object> rowPattern;
private Table table;
private final String execId;
private final IndexSelector indexSelector;
private final Map<String, Object> rowPattern;
private final Table table;

public DeleteCommand(Table _table, Map<String, Object> _rowPattern, String _execId) {
indexSelector = new IndexSelector(_table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

public class DropForeignKeyCommand implements ICommand {

private String execId;
private String relationshipName;
private final String execId;
private final String relationshipName;

public DropForeignKeyCommand(String _execId, String _relationshipName) {
execId = _execId;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/ucanaccess/commands/DropTableCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.sql.SQLException;

public class DropTableCommand implements ICommand {
private String execId;
private String tableName;
private final String execId;
private final String tableName;

public DropTableCommand(String _tableName, String _execId) {
tableName = _tableName;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/ucanaccess/commands/IndexSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

public final class IndexSelector {

private Index bestIndex;
private boolean primaryCursor;
private Table table;
private final Table table;
private Index bestIndex;
private boolean primaryCursor;

public IndexSelector(Table _table) {
table = _table;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/ucanaccess/commands/InsertCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import java.util.List;

public class InsertCommand implements ICommand {
private Database dbIO;
private String execId;
private Object[] newRow;
private Table table;
private String tableName;
private final String tableName;
private Database dbIO;
private Object[] newRow;
private final String execId;
private Table table;

public InsertCommand(String _tableName, Database _dbIo, Object[] _newRow, String _execId) {
tableName = _tableName;
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/net/ucanaccess/commands/UpdateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@
import java.util.Map;

public class UpdateCommand extends AbstractCursorCommand {
private List<Column> blobColumns;
private String execId;
private IndexSelector indexSelector;
private Object[] modifiedRow;
private Map<String, Object> rowPattern;
private Table table;
private List<? extends Column> tableColumns;
private boolean isRollbacking;

public UpdateCommand(Table _table, Map<String, Object> _map, Object[] _modifiedRow, String _execId) {
private final List<? extends Column> tableColumns;
private final IndexSelector indexSelector;
private final Map<String, Object> rowPattern;
private final Object[] modifiedRow;
private final String execId;
private List<Column> blobColumns;
private final Table table;
private boolean isRollbacking;

public UpdateCommand(Table _table, Map<String, Object> _rowPattern, Object[] _modifiedRow, String _execId) {
tableColumns = _table.getColumns();
indexSelector = new IndexSelector(_table);
rowPattern = _map;
rowPattern = _rowPattern;
modifiedRow = _modifiedRow;
execId = _execId;
checkBlob(_modifiedRow);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/ucanaccess/complex/ComplexBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public abstract class ComplexBase implements Serializable {
private static final long serialVersionUID = 1L;
public static final ComplexValue.Id CREATE_ID = ComplexColumnInfoImpl.INVALID_ID;

private int id;
private final int id;
private String tableName;
private String columnName;

Expand Down
18 changes: 9 additions & 9 deletions src/main/java/net/ucanaccess/console/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
import java.util.stream.Collectors;

public class Main {
private static final String EXPORT_USAGE = "export [--help] [--bom] [-d <delimiter>] [-t <table>] "
+ "[--big_query_schema <pathToSchemaFile>] " + "[--newlines] <pathToCsv>";
private static final String EXPORT_USAGE = "export [--help] [--bom] [-d <delimiter>] [-t <table>] "
+ "[--big_query_schema <pathToSchemaFile>] " + "[--newlines] <pathToCsv>";

private static final String EXPORT_PROMPT = "Export command syntax is: " + EXPORT_USAGE;
private static final String EXPORT_PROMPT = "Export command syntax is: " + EXPORT_USAGE;

private static boolean batchMode = false;
private Connection conn;
private boolean connected = true;
private BufferedReader input;
private String lastSqlQuery;
private static boolean batchMode = false;
private final Connection conn;
private boolean connected = true;
private final BufferedReader input;
private String lastSqlQuery;

public Main(Connection _conn, BufferedReader _input) {
conn = _conn;
Expand Down Expand Up @@ -430,7 +430,7 @@ static class TableFormat {
static final List<Integer> NUMERIC_JDBC_TYPES =
List.of(Types.BIT, Types.TINYINT, Types.SMALLINT, Types.INTEGER, Types.BIGINT, Types.FLOAT,
Types.REAL, Types.DOUBLE, Types.NUMERIC, Types.DECIMAL, Types.ROWID);
private int maxColWidth = 50;
private final int maxColWidth = 50;
private final List<String> colNames;
private final List<Integer> colWidths;
private final List<Integer> colTypes;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/ucanaccess/converters/DFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class DFunction {
List.of("COUNT", "MAX", "MIN", "SUM", "AVG", "LAST", "FIRST", "LOOKUP");

private Connection conn;
private String sql;
private final String sql;

public DFunction(Connection _conn, String _sql) {
conn = _conn;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/ucanaccess/converters/LoadJet.java
Original file line number Diff line number Diff line change
Expand Up @@ -1293,12 +1293,12 @@ void synchronisationTriggers(String tableName, boolean hasAutoNumberColumn, bool
}

private final class ViewsLoader {
private static final int OBJECT_ALREADY_EXISTS = -ErrorCode.X_42504;
private static final int OBJECT_NOT_FOUND = -ErrorCode.X_42501;
private static final int UNEXPECTED_TOKEN = -ErrorCode.X_42581;
private static final int OBJECT_ALREADY_EXISTS = -ErrorCode.X_42504;
private static final int OBJECT_NOT_FOUND = -ErrorCode.X_42501;
private static final int UNEXPECTED_TOKEN = -ErrorCode.X_42581;

private Map<String, String> notLoaded = new HashMap<>();
private Map<String, String> notLoadedProcedure = new HashMap<>();
private final Map<String, String> notLoaded = new HashMap<>();
private final Map<String, String> notLoadedProcedure = new HashMap<>();

private boolean loadView(Query _q) throws SQLException {
return loadView(_q, null);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/ucanaccess/converters/Metadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static Property parse(Object _val) {
private static final String RENAME =
"UPDATE UCA_METADATA.TABLES SET TABLE_NAME=?, ESCAPED_TABLE_NAME=? WHERE TABLE_NAME=?";

private Connection conn;
private final Connection conn;

public Metadata(Connection _conn) {
conn = _conn;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/ucanaccess/converters/ParametricQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import java.util.regex.Pattern;

public class ParametricQuery {
private Connection hsqldb;
private QueryImpl qi;
private final Connection hsqldb;
private final QueryImpl qi;
private boolean loaded;
private PreparedStatement ps;
private String parameters;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/net/ucanaccess/converters/Persist2Jet.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import java.util.*;

public class Persist2Jet {
private static Map<String, List<String>> columnNamesCache = new HashMap<>();
private static final Map<String, List<String>> COL_NAMES_CACHE = new HashMap<>();
static {
DBReference.addOnReloadRefListener(() -> columnNamesCache.clear());
DBReference.addOnReloadRefListener(COL_NAMES_CACHE::clear);
}

public Map<String, Object> getRowPattern(Object[] varr, Table t) throws SQLException {
Expand Down Expand Up @@ -57,7 +57,7 @@ private List<String> getColumnNames(String ntn) throws SQLException {
String pref = conn.getDbIO().getFile().getAbsolutePath();
Connection conq = conn.getHSQLDBConnection();
String key = pref + ntn;
if (!columnNamesCache.containsKey(key)) {
if (!COL_NAMES_CACHE.containsKey(key)) {
ResultSet rs = conq.getMetaData().getColumns(null, PUBLIC, ntn, null);
Map<Integer, String> tm = new TreeMap<>();
while (rs.next()) {
Expand All @@ -67,9 +67,9 @@ private List<String> getColumnNames(String ntn) throws SQLException {

}
List<String> ar = new ArrayList<>(tm.values());
columnNamesCache.put(key, ar);
COL_NAMES_CACHE.put(key, ar);
}
return columnNamesCache.get(key);
return COL_NAMES_CACHE.get(key);
}

private List<String> getColumnNamesCreate(String ntn) throws SQLException {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/ucanaccess/converters/Pivot.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Pivot {
private String pivot;
private List<String> pivotIn;
private String aggregateFun;
private Connection conn;
private final Connection conn;
private boolean pivotInCondition = true;
private String originalQuery;

Expand Down
Loading

0 comments on commit 77ffbe5

Please sign in to comment.