Skip to content

Commit 24ebaec

Browse files
Style: QA/CI exceptions
Signed-off-by: Andreas Reichel <andreas@manticore-projects.com> Signed-off-by: manticore-projects <andreas@manticore-projects.com>
1 parent b855982 commit 24ebaec

File tree

1 file changed

+93
-59
lines changed

1 file changed

+93
-59
lines changed

src/main/java/net/sf/jsqlparser/statement/alter/AlterExpression.java

Lines changed: 93 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,29 @@ public class AlterExpression implements Serializable {
5454
private boolean usingIfExists;
5555

5656
/**
57-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
57+
* @deprecated Use {@link #setIndex(Index)} with a
58+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
5859
*/
5960
@Deprecated
6061
private List<String> fkColumns;
6162

6263
/**
63-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
64+
* @deprecated Use {@link #setIndex(Index)} with a
65+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
6466
*/
6567
@Deprecated
6668
private String fkSourceSchema;
6769

6870
/**
69-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
71+
* @deprecated Use {@link #setIndex(Index)} with a
72+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
7073
*/
7174
@Deprecated
7275
private String fkSourceTable;
7376

7477
/**
75-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
78+
* @deprecated Use {@link #setIndex(Index)} with a
79+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
7680
*/
7781
@Deprecated
7882
private List<String> fkSourceColumns;
@@ -155,15 +159,17 @@ public void hasColumns(boolean hasColumns) {
155159
}
156160

157161
/**
158-
* @deprecated Use {@link #getIndex()} with {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
162+
* @deprecated Use {@link #getIndex()} with
163+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
159164
*/
160165
@Deprecated
161166
public String getFkSourceSchema() {
162167
return fkSourceSchema;
163168
}
164169

165170
/**
166-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
171+
* @deprecated Use {@link #setIndex(Index)} with a
172+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
167173
*/
168174
@Deprecated
169175
public void setFkSourceSchema(String fkSourceSchema) {
@@ -205,7 +211,9 @@ public void setOptionalSpecifier(String optionalSpecifier) {
205211
/**
206212
* @param type
207213
* @param action
208-
* @deprecated Standalone FK fields are deprecated. Use a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} via {@link #setIndex(Index)} instead.
214+
* @deprecated Standalone FK fields are deprecated. Use a
215+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} via
216+
* {@link #setIndex(Index)} instead.
209217
*/
210218
@Deprecated
211219
public void setReferentialAction(Type type, Action action) {
@@ -238,9 +246,9 @@ public void removeReferentialAction(Type type) {
238246
@Deprecated
239247
public ReferentialAction getReferentialAction(Type type) {
240248
return referentialActions.stream()
241-
.filter(ra -> type.equals(ra.getType()))
242-
.findFirst()
243-
.orElse(null);
249+
.filter(ra -> type.equals(ra.getType()))
250+
.findFirst()
251+
.orElse(null);
244252
}
245253

246254
private void setReferentialAction(Type type, Action action, boolean set) {
@@ -317,31 +325,35 @@ public void setOnDeleteSetNull(boolean onDeleteSetNull) {
317325
}
318326

319327
/**
320-
* @deprecated Use {@link #getIndex()} with {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
328+
* @deprecated Use {@link #getIndex()} with
329+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
321330
*/
322331
@Deprecated
323332
public List<String> getFkColumns() {
324333
return fkColumns;
325334
}
326335

327336
/**
328-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
337+
* @deprecated Use {@link #setIndex(Index)} with a
338+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
329339
*/
330340
@Deprecated
331341
public void setFkColumns(List<String> fkColumns) {
332342
this.fkColumns = fkColumns;
333343
}
334344

335345
/**
336-
* @deprecated Use {@link #getIndex()} with {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
346+
* @deprecated Use {@link #getIndex()} with
347+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
337348
*/
338349
@Deprecated
339350
public String getFkSourceTable() {
340351
return fkSourceTable;
341352
}
342353

343354
/**
344-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
355+
* @deprecated Use {@link #setIndex(Index)} with a
356+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
345357
*/
346358
@Deprecated
347359
public void setFkSourceTable(String fkSourceTable) {
@@ -404,15 +416,17 @@ public List<ColumnSetVisibility> getColumnSetVisibilityList() {
404416
}
405417

406418
/**
407-
* @deprecated Use {@link #getIndex()} with {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
419+
* @deprecated Use {@link #getIndex()} with
420+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
408421
*/
409422
@Deprecated
410423
public List<String> getFkSourceColumns() {
411424
return fkSourceColumns;
412425
}
413426

414427
/**
415-
* @deprecated Use {@link #setIndex(Index)} with a {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
428+
* @deprecated Use {@link #setIndex(Index)} with a
429+
* {@link net.sf.jsqlparser.statement.create.table.ForeignKeyIndex} instead.
416430
*/
417431
@Deprecated
418432
public void setFkSourceColumns(List<String> fkSourceColumns) {
@@ -724,12 +738,12 @@ public String toString() {
724738
if (operation == AlterOperation.UNSPECIFIC) {
725739
b.append(optionalSpecifier);
726740
} else if (constraintType != null && constraintSymbol != null
727-
&& (operation == AlterOperation.ALTER || operation == AlterOperation.ADD)) {
741+
&& (operation == AlterOperation.ALTER || operation == AlterOperation.ADD)) {
728742
toStringConstraintAlter(b);
729743
} else if (operation == AlterOperation.ALTER
730-
&& (columnDropDefaultList != null && !columnDropDefaultList.isEmpty()
731-
|| columnSetDefaultList != null && !columnSetDefaultList.isEmpty()
732-
|| columnSetVisibilityList != null && !columnSetVisibilityList.isEmpty())) {
744+
&& (columnDropDefaultList != null && !columnDropDefaultList.isEmpty()
745+
|| columnSetDefaultList != null && !columnSetDefaultList.isEmpty()
746+
|| columnSetVisibilityList != null && !columnSetVisibilityList.isEmpty())) {
733747
toStringAlterColumn(b);
734748
} else if (isSimpleKeywordOperation()) {
735749
toStringSimpleKeyword(b);
@@ -823,10 +837,10 @@ private void toStringConstraintAlter(StringBuilder b) {
823837
}
824838
} else {
825839
b.append("ADD CONSTRAINT ").append(constraintType).append(" ").append(constraintSymbol)
826-
.append(" ");
840+
.append(" ");
827841
if (index != null && index.getColumnsNames() != null) {
828842
b.append(" ")
829-
.append(PlainSelect.getStringList(index.getColumnsNames(), true, true));
843+
.append(PlainSelect.getStringList(index.getColumnsNames(), true, true));
830844
}
831845
}
832846
}
@@ -864,22 +878,30 @@ private void toStringSimpleKeyword(StringBuilder b) {
864878
break;
865879
case ENGINE:
866880
b.append("ENGINE ");
867-
if (useEqual) { b.append("= "); }
881+
if (useEqual) {
882+
b.append("= ");
883+
}
868884
b.append(engineOption);
869885
break;
870886
case ALGORITHM:
871887
b.append("ALGORITHM ");
872-
if (useEqual) { b.append("= "); }
888+
if (useEqual) {
889+
b.append("= ");
890+
}
873891
b.append(algorithmOption);
874892
break;
875893
case KEY_BLOCK_SIZE:
876894
b.append("KEY_BLOCK_SIZE ");
877-
if (useEqual) { b.append("= "); }
895+
if (useEqual) {
896+
b.append("= ");
897+
}
878898
b.append(keyBlockSize);
879899
break;
880900
case LOCK:
881901
b.append("LOCK ");
882-
if (useEqual) { b.append("= "); }
902+
if (useEqual) {
903+
b.append("= ");
904+
}
883905
b.append(lockOption);
884906
break;
885907
}
@@ -915,7 +937,7 @@ private void toStringDropSpecial(StringBuilder b) {
915937
break;
916938
case DROP_FOREIGN_KEY:
917939
b.append("DROP FOREIGN KEY (").append(PlainSelect.getStringList(pkColumns))
918-
.append(')');
940+
.append(')');
919941
break;
920942
default:
921943
// Oracle Multi Column Drop
@@ -930,25 +952,33 @@ private void toStringConvert(StringBuilder b) {
930952
b.append("CONVERT TO CHARACTER SET ");
931953
} else if (convertType == ConvertType.DEFAULT_CHARACTER_SET) {
932954
b.append("DEFAULT CHARACTER SET ");
933-
if (hasEqualForCharacterSet) { b.append("= "); }
955+
if (hasEqualForCharacterSet) {
956+
b.append("= ");
957+
}
934958
} else if (convertType == ConvertType.CHARACTER_SET) {
935959
b.append("CHARACTER SET ");
936-
if (hasEqualForCharacterSet) { b.append("= "); }
960+
if (hasEqualForCharacterSet) {
961+
b.append("= ");
962+
}
937963
}
938964
if (getCharacterSet() != null) {
939965
b.append(getCharacterSet());
940966
}
941967
if (getCollation() != null) {
942968
b.append(" COLLATE ");
943-
if (hasEqualForCollate) { b.append("= "); }
969+
if (hasEqualForCollate) {
970+
b.append("= ");
971+
}
944972
b.append(getCollation());
945973
}
946974
} else {
947975
if (isDefaultCollateSpecified()) {
948976
b.append("DEFAULT ");
949977
}
950978
b.append("COLLATE ");
951-
if (hasEqualForCollate) { b.append("= "); }
979+
if (hasEqualForCollate) {
980+
b.append("= ");
981+
}
952982
if (getCollation() != null) {
953983
b.append(getCollation());
954984
}
@@ -960,11 +990,15 @@ private void toStringPartition(StringBuilder b) {
960990
switch (operation) {
961991
case DISCARD_PARTITION:
962992
b.append("DISCARD PARTITION ").append(PlainSelect.getStringList(partitions));
963-
if (tableOption != null) { b.append(" ").append(tableOption); }
993+
if (tableOption != null) {
994+
b.append(" ").append(tableOption);
995+
}
964996
break;
965997
case IMPORT_PARTITION:
966998
b.append("IMPORT PARTITION ").append(PlainSelect.getStringList(partitions));
967-
if (tableOption != null) { b.append(" ").append(tableOption); }
999+
if (tableOption != null) {
1000+
b.append(" ").append(tableOption);
1001+
}
9681002
break;
9691003
case TRUNCATE_PARTITION:
9701004
b.append("TRUNCATE PARTITION ").append(PlainSelect.getStringList(partitions));
@@ -974,17 +1008,17 @@ private void toStringPartition(StringBuilder b) {
9741008
break;
9751009
case REORGANIZE_PARTITION:
9761010
b.append("REORGANIZE PARTITION ")
977-
.append(PlainSelect.getStringList(partitions))
978-
.append(" INTO (")
979-
.append(partitionDefinitions.stream()
980-
.map(PartitionDefinition::toString)
981-
.collect(Collectors.joining(", ")))
982-
.append(")");
1011+
.append(PlainSelect.getStringList(partitions))
1012+
.append(" INTO (")
1013+
.append(partitionDefinitions.stream()
1014+
.map(PartitionDefinition::toString)
1015+
.collect(Collectors.joining(", ")))
1016+
.append(")");
9831017
break;
9841018
case EXCHANGE_PARTITION:
9851019
b.append("EXCHANGE PARTITION ");
9861020
b.append(partitions.get(0)).append(" WITH TABLE ")
987-
.append(exchangePartitionTableName);
1021+
.append(exchangePartitionTableName);
9881022
if (exchangePartitionWithValidation) {
9891023
b.append(" WITH VALIDATION ");
9901024
} else if (exchangePartitionWithoutValidation) {
@@ -1017,16 +1051,16 @@ private void toStringPartition(StringBuilder b) {
10171051
b.append("COLUMNS(").append(String.join(", ", partitionColumns)).append(") ");
10181052
}
10191053
b.append("(").append(partitionDefinitions.stream()
1020-
.map(PartitionDefinition::toString)
1021-
.collect(Collectors.joining(", ")))
1022-
.append(")");
1054+
.map(PartitionDefinition::toString)
1055+
.collect(Collectors.joining(", ")))
1056+
.append(")");
10231057
break;
10241058
}
10251059
}
10261060

10271061
/**
1028-
* Handles the general case for ADD, MODIFY, CHANGE, DROP (column), COMMENT,
1029-
* row-level security, and all field-based dispatch (columns, constraints, FK, UK, PK, index).
1062+
* Handles the general case for ADD, MODIFY, CHANGE, DROP (column), COMMENT, row-level security,
1063+
* and all field-based dispatch (columns, constraints, FK, UK, PK, index).
10301064
*/
10311065
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
10321066
private void toStringGeneral(StringBuilder b) {
@@ -1074,7 +1108,7 @@ private void toStringGeneral(StringBuilder b) {
10741108
b.append("COLUMNS ");
10751109
}
10761110
if (useIfNotExists
1077-
&& operation == AlterOperation.ADD) {
1111+
&& operation == AlterOperation.ADD) {
10781112
b.append("IF NOT EXISTS ");
10791113
}
10801114
}
@@ -1118,19 +1152,19 @@ private void toStringGeneral(StringBuilder b) {
11181152
}
11191153
b.append(" (").append(PlainSelect.getStringList(ukColumns)).append(")");
11201154
} else if (fkColumns != null
1121-
&& !(index instanceof net.sf.jsqlparser.statement.create.table.ForeignKeyIndex)) {
1155+
&& !(index instanceof net.sf.jsqlparser.statement.create.table.ForeignKeyIndex)) {
11221156
// @deprecated path - kept for backward compatibility when ForeignKeyIndex is not set
11231157
b.append("FOREIGN KEY (")
1124-
.append(PlainSelect.getStringList(fkColumns))
1125-
.append(") REFERENCES ")
1126-
.append(
1127-
fkSourceSchema != null && fkSourceSchema.trim().length() > 0
1128-
? fkSourceSchema + "."
1129-
: "")
1130-
.append(fkSourceTable)
1131-
.append(" (")
1132-
.append(PlainSelect.getStringList(fkSourceColumns))
1133-
.append(")");
1158+
.append(PlainSelect.getStringList(fkColumns))
1159+
.append(") REFERENCES ")
1160+
.append(
1161+
fkSourceSchema != null && fkSourceSchema.trim().length() > 0
1162+
? fkSourceSchema + "."
1163+
: "")
1164+
.append(fkSourceTable)
1165+
.append(" (")
1166+
.append(PlainSelect.getStringList(fkSourceColumns))
1167+
.append(")");
11341168
referentialActions.forEach(b::append);
11351169
} else if (index != null) {
11361170
b.append(index);
@@ -1364,7 +1398,7 @@ public ColumnDataType(
13641398
@Override
13651399
public String toString() {
13661400
return getColumnName() + (withType ? " TYPE " : getColDataType() == null ? "" : " ")
1367-
+ toStringDataTypeAndSpec();
1401+
+ toStringDataTypeAndSpec();
13681402
}
13691403

13701404
@Override
@@ -1488,4 +1522,4 @@ public String toString() {
14881522
public enum ConvertType {
14891523
CONVERT_TO, DEFAULT_CHARACTER_SET, CHARACTER_SET
14901524
}
1491-
}
1525+
}

0 commit comments

Comments
 (0)