Skip to content

Commit ed17f87

Browse files
style: apply Spotless
1 parent 0979b2e commit ed17f87

2 files changed

Lines changed: 49 additions & 35 deletions

File tree

src/main/java/net/sf/jsqlparser/statement/select/Fetch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public long getRowCount() {
2525

2626
@Deprecated
2727
public void setRowCount(long l) {
28-
setExpression( new LongValue(l));
28+
setExpression(new LongValue(l));
2929
}
3030

3131
public Expression getExpression() {
@@ -69,8 +69,8 @@ public void setFetchParamFirst(boolean b) {
6969

7070
@Override
7171
public String toString() {
72-
return " FETCH " + (isFetchParamFirst ? "FIRST" : "NEXT") + " "
73-
+ expression.toString() + " " + fetchParam + " ONLY";
72+
return " FETCH " + (isFetchParamFirst ? "FIRST" : "NEXT") + " " + expression.toString()
73+
+ " " + fetchParam + " ONLY";
7474
}
7575

7676
public Fetch withRowCount(long rowCount) {

src/main/java/net/sf/jsqlparser/util/deparser/SelectDeParser.java

Lines changed: 46 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
import net.sf.jsqlparser.statement.values.ValuesStatement;
5353

5454
@SuppressWarnings({"PMD.CyclomaticComplexity"})
55-
public class SelectDeParser extends AbstractDeParser<PlainSelect>
56-
implements SelectVisitor, SelectItemVisitor, FromItemVisitor, PivotVisitor, ItemsListVisitor {
55+
public class SelectDeParser extends AbstractDeParser<PlainSelect> implements SelectVisitor,
56+
SelectItemVisitor, FromItemVisitor, PivotVisitor, ItemsListVisitor {
5757

5858
private ExpressionVisitor expressionVisitor;
5959

@@ -71,7 +71,8 @@ public SelectDeParser(ExpressionVisitor expressionVisitor, StringBuilder buffer)
7171
}
7272

7373
@Override
74-
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.ExcessiveMethodLength", "PMD.NPathComplexity"})
74+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.ExcessiveMethodLength",
75+
"PMD.NPathComplexity"})
7576
public void visit(PlainSelect plainSelect) {
7677
if (plainSelect.isUseBrackets()) {
7778
buffer.append("(");
@@ -105,8 +106,8 @@ public void visit(PlainSelect plainSelect) {
105106
}
106107
if (plainSelect.getDistinct().getOnSelectItems() != null) {
107108
buffer.append("ON (");
108-
for (Iterator<SelectItem> iter = plainSelect.getDistinct().getOnSelectItems().iterator(); iter
109-
.hasNext();) {
109+
for (Iterator<SelectItem> iter =
110+
plainSelect.getDistinct().getOnSelectItems().iterator(); iter.hasNext();) {
110111
SelectItem selectItem = iter.next();
111112
selectItem.accept(this);
112113
if (iter.hasNext()) {
@@ -185,7 +186,8 @@ public void visit(PlainSelect plainSelect) {
185186
}
186187
if (plainSelect.getWindowDefinitions() != null) {
187188
buffer.append(" WINDOW ");
188-
buffer.append(plainSelect.getWindowDefinitions().stream().map(WindowDefinition::toString).collect(joining(", ")));
189+
buffer.append(plainSelect.getWindowDefinitions().stream()
190+
.map(WindowDefinition::toString).collect(joining(", ")));
189191
}
190192
if (plainSelect.getOrderByElements() != null) {
191193
new OrderByDeParser(expressionVisitor, buffer).deParse(plainSelect.isOracleSiblings(),
@@ -251,7 +253,8 @@ public void visit(SubSelect subSelect) {
251253
buffer.append(subSelect.isUseBrackets() ? "(" : "");
252254
if (subSelect.getWithItemsList() != null && !subSelect.getWithItemsList().isEmpty()) {
253255
buffer.append("WITH ");
254-
for (Iterator<WithItem> iter = subSelect.getWithItemsList().iterator(); iter.hasNext();) {
256+
for (Iterator<WithItem> iter = subSelect.getWithItemsList().iterator(); iter
257+
.hasNext();) {
255258
WithItem withItem = iter.next();
256259
withItem.accept(this);
257260
if (iter.hasNext()) {
@@ -305,9 +308,12 @@ public void visit(Table tableName) {
305308
@Override
306309
public void visit(Pivot pivot) {
307310
List<Column> forColumns = pivot.getForColumns();
308-
buffer.append(" PIVOT (").append(PlainSelect.getStringList(pivot.getFunctionItems())).append(" FOR ")
309-
.append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1))
310-
.append(" IN ").append(PlainSelect.getStringList(pivot.getInItems(), true, true)).append(")");
311+
buffer.append(" PIVOT (").append(PlainSelect.getStringList(pivot.getFunctionItems()))
312+
.append(" FOR ")
313+
.append(PlainSelect.getStringList(forColumns, true,
314+
forColumns != null && forColumns.size() > 1))
315+
.append(" IN ").append(PlainSelect.getStringList(pivot.getInItems(), true, true))
316+
.append(")");
311317
if (pivot.getAlias() != null) {
312318
buffer.append(pivot.getAlias().toString());
313319
}
@@ -319,15 +325,16 @@ public void visit(UnPivot unpivot) {
319325
boolean includeNulls = unpivot.getIncludeNulls();
320326
List<Column> unPivotClause = unpivot.getUnPivotClause();
321327
List<Column> unpivotForClause = unpivot.getUnPivotForClause();
322-
buffer
323-
.append(" UNPIVOT")
324-
.append(showOptions && includeNulls ? " INCLUDE NULLS" : "")
325-
.append(showOptions && !includeNulls ? " EXCLUDE NULLS" : "")
326-
.append(" (").append(PlainSelect.getStringList(unPivotClause, true,
327-
unPivotClause != null && unPivotClause.size() > 1))
328-
.append(" FOR ").append(PlainSelect.getStringList(unpivotForClause, true,
329-
unpivotForClause != null && unpivotForClause.size() > 1))
330-
.append(" IN ").append(PlainSelect.getStringList(unpivot.getUnPivotInClause(), true, true)).append(")");
328+
buffer.append(" UNPIVOT").append(showOptions && includeNulls ? " INCLUDE NULLS" : "")
329+
.append(showOptions && !includeNulls ? " EXCLUDE NULLS" : "").append(" (")
330+
.append(PlainSelect.getStringList(unPivotClause, true,
331+
unPivotClause != null && unPivotClause.size() > 1))
332+
.append(" FOR ")
333+
.append(PlainSelect.getStringList(unpivotForClause, true,
334+
unpivotForClause != null && unpivotForClause.size() > 1))
335+
.append(" IN ")
336+
.append(PlainSelect.getStringList(unpivot.getUnPivotInClause(), true, true))
337+
.append(")");
331338
if (unpivot.getAlias() != null) {
332339
buffer.append(unpivot.getAlias().toString());
333340
}
@@ -336,8 +343,9 @@ public void visit(UnPivot unpivot) {
336343
@Override
337344
public void visit(PivotXml pivot) {
338345
List<Column> forColumns = pivot.getForColumns();
339-
buffer.append(" PIVOT XML (").append(PlainSelect.getStringList(pivot.getFunctionItems())).append(" FOR ")
340-
.append(PlainSelect.getStringList(forColumns, true, forColumns != null && forColumns.size() > 1))
346+
buffer.append(" PIVOT XML (").append(PlainSelect.getStringList(pivot.getFunctionItems()))
347+
.append(" FOR ").append(PlainSelect.getStringList(forColumns, true,
348+
forColumns != null && forColumns.size() > 1))
341349
.append(" IN (");
342350
if (pivot.isInAny()) {
343351
buffer.append("ANY");
@@ -397,7 +405,7 @@ public void visit(SubJoin subjoin) {
397405

398406
@SuppressWarnings({"PMD.CyclomaticComplexity"})
399407
public void deparseJoin(Join join) {
400-
if ( join.isGlobal() ) {
408+
if (join.isGlobal()) {
401409
buffer.append(" GLOBAL ");
402410
}
403411

@@ -451,7 +459,8 @@ public void deparseJoin(Join join) {
451459
}
452460
if (join.getUsingColumns().size() > 0) {
453461
buffer.append(" USING (");
454-
for (Iterator<Column> iterator = join.getUsingColumns().iterator(); iterator.hasNext();) {
462+
for (Iterator<Column> iterator = join.getUsingColumns().iterator(); iterator
463+
.hasNext();) {
455464
Column column = iterator.next();
456465
buffer.append(column.toString());
457466
if (iterator.hasNext()) {
@@ -503,7 +512,8 @@ public void visit(WithItem withItem) {
503512
}
504513
buffer.append(withItem.getName());
505514
if (withItem.getWithItemList() != null) {
506-
buffer.append(" ").append(PlainSelect.getStringList(withItem.getWithItemList(), true, true));
515+
buffer.append(" ")
516+
.append(PlainSelect.getStringList(withItem.getWithItemList(), true, true));
507517
}
508518
buffer.append(" AS ");
509519

@@ -513,8 +523,8 @@ public void visit(WithItem withItem) {
513523
buffer.append("(VALUES ");
514524

515525
ExpressionList expressionList = (ExpressionList) itemsList;
516-
buffer.append(
517-
PlainSelect.getStringList(expressionList.getExpressions(), true, useBracketsForValues));
526+
buffer.append(PlainSelect.getStringList(expressionList.getExpressions(), true,
527+
useBracketsForValues));
518528
buffer.append(")");
519529
} else {
520530
SubSelect subSelect = withItem.getSubSelect();
@@ -536,12 +546,14 @@ public void visit(LateralSubSelect lateralSubSelect) {
536546
@Override
537547
public void visit(ValuesList valuesList) {
538548
buffer.append("(VALUES ");
539-
List<ExpressionList> expressionLists = valuesList.getMultiExpressionList().getExpressionLists();
549+
List<ExpressionList> expressionLists =
550+
valuesList.getMultiExpressionList().getExpressionLists();
540551
int n = expressionLists.size() - 1;
541552
int i = 0;
542553
for (ExpressionList expressionList : expressionLists) {
543-
new ExpressionListDeParser(expressionVisitor, buffer, !valuesList.isNoBrackets(), true).deParse(expressionList.getExpressions());
544-
if (i<n) {
554+
new ExpressionListDeParser(expressionVisitor, buffer, !valuesList.isNoBrackets(), true)
555+
.deParse(expressionList.getExpressions());
556+
if (i < n) {
545557
buffer.append(", ");
546558
}
547559
i++;
@@ -602,7 +614,8 @@ void deParse(PlainSelect statement) {
602614

603615
@Override
604616
public void visit(ExpressionList expressionList) {
605-
new ExpressionListDeParser(expressionVisitor, buffer, expressionList.isUsingBrackets(), true).deParse(expressionList.getExpressions());
617+
new ExpressionListDeParser(expressionVisitor, buffer, expressionList.isUsingBrackets(),
618+
true).deParse(expressionList.getExpressions());
606619
}
607620

608621
@Override
@@ -632,8 +645,9 @@ public void visit(MultiExpressionList multiExprList) {
632645
int n = expressionLists.size() - 1;
633646
int i = 0;
634647
for (ExpressionList expressionList : expressionLists) {
635-
new ExpressionListDeParser(expressionVisitor, buffer, expressionList.isUsingBrackets(), true).deParse(expressionList.getExpressions());
636-
if (i<n) {
648+
new ExpressionListDeParser(expressionVisitor, buffer, expressionList.isUsingBrackets(),
649+
true).deParse(expressionList.getExpressions());
650+
if (i < n) {
637651
buffer.append(", ");
638652
}
639653
i++;

0 commit comments

Comments
 (0)