Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@
public class OrderByElement {

public enum NullOrdering {

NULLS_FIRST,
NULLS_LAST
}

private Expression expression;
private boolean asc = true;
private boolean ascDescPresent = false;
private NullOrdering nullOrdering;
private boolean ascDesc = false;

public boolean isAsc() {
return asc;
Expand All @@ -36,16 +35,16 @@ public void setNullOrdering(NullOrdering nullOrdering) {
this.nullOrdering = nullOrdering;
}

public void setAsc(boolean b) {
asc = b;
public void setAsc(boolean asc) {
this.asc = asc;
}

public void setAscDescPresent(boolean b) {
ascDesc = b;
public void setAscDescPresent(boolean ascDescPresent) {
this.ascDescPresent = ascDescPresent;
}

public boolean isAscDescPresent() {
return ascDesc;
return ascDescPresent;
}

public void accept(OrderByVisitor orderByVisitor) {
Expand All @@ -67,7 +66,7 @@ public String toString() {

if (!asc) {
b.append(" DESC");
} else if (ascDesc) {
} else if (ascDescPresent) {
b.append(" ASC");
}

Expand All @@ -88,6 +87,11 @@ public OrderByElement withAsc(boolean asc) {
return this;
}

public OrderByElement withAscDescPresent(boolean ascDescPresent) {
this.setAscDescPresent(ascDescPresent);
return this;
}

public OrderByElement withNullOrdering(NullOrdering nullOrdering) {
this.setNullOrdering(nullOrdering);
return this;
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/net/sf/jsqlparser/util/RandomUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ public static <T> T getRandomValueForType(Class<T> type) {
}
}
}
return type.cast(value);
// do not use type.cast (does not support primitive types and
// autoboxing/unboxing
@SuppressWarnings("unchecked")
T t = (T) value;
return t;
}

}