Skip to content

Commit 4d9667f

Browse files
committed
Adopt to changed Sort.Order constructor.
Closes #2946
1 parent 878db1d commit 4d9667f

File tree

1 file changed

+10
-17
lines changed
  • spring-data-jpa/src/main/java/org/springframework/data/jpa/domain

1 file changed

+10
-17
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/JpaSort.java

+10-17
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
*/
1616
package org.springframework.data.jpa.domain;
1717

18+
import jakarta.persistence.metamodel.Attribute;
19+
import jakarta.persistence.metamodel.PluralAttribute;
20+
1821
import java.util.ArrayList;
1922
import java.util.Arrays;
2023
import java.util.Collection;
2124
import java.util.Collections;
2225
import java.util.List;
2326

24-
import jakarta.persistence.metamodel.Attribute;
25-
import jakarta.persistence.metamodel.PluralAttribute;
26-
2727
import org.springframework.data.domain.Sort;
2828
import org.springframework.lang.Nullable;
2929
import org.springframework.util.Assert;
@@ -364,7 +364,6 @@ public static class JpaOrder extends Order {
364364
private static final long serialVersionUID = 1L;
365365

366366
private final boolean unsafe;
367-
private final boolean ignoreCase;
368367

369368
/**
370369
* Creates a new {@link JpaOrder} instance. if order is {@literal null} then order defaults to
@@ -386,25 +385,24 @@ private JpaOrder(@Nullable Direction direction, String property) {
386385
* @param nullHandlingHint can be {@literal null}, will default to {@link NullHandling#NATIVE}.
387386
*/
388387
private JpaOrder(@Nullable Direction direction, String property, NullHandling nullHandlingHint) {
389-
this(direction, property, nullHandlingHint, false, true);
388+
this(direction, property, false, nullHandlingHint, true);
390389
}
391390

392-
private JpaOrder(@Nullable Direction direction, String property, NullHandling nullHandling, boolean ignoreCase,
391+
private JpaOrder(@Nullable Direction direction, String property, boolean ignoreCase, NullHandling nullHandling,
393392
boolean unsafe) {
394393

395-
super(direction, property, nullHandling);
396-
this.ignoreCase = ignoreCase;
394+
super(direction, property, ignoreCase, nullHandling);
397395
this.unsafe = unsafe;
398396
}
399397

400398
@Override
401399
public JpaOrder with(Direction order) {
402-
return new JpaOrder(order, getProperty(), getNullHandling(), isIgnoreCase(), this.unsafe);
400+
return new JpaOrder(order, getProperty(), isIgnoreCase(), getNullHandling(), this.unsafe);
403401
}
404402

405403
@Override
406404
public JpaOrder with(NullHandling nullHandling) {
407-
return new JpaOrder(getDirection(), getProperty(), nullHandling, isIgnoreCase(), this.unsafe);
405+
return new JpaOrder(getDirection(), getProperty(), isIgnoreCase(), nullHandling, this.unsafe);
408406
}
409407

410408
/**
@@ -421,20 +419,15 @@ public Sort withUnsafe(String... properties) {
421419
List<Order> orders = new ArrayList<>(properties.length);
422420

423421
for (String property : properties) {
424-
orders.add(new JpaOrder(getDirection(), property, getNullHandling(), isIgnoreCase(), this.unsafe));
422+
orders.add(new JpaOrder(getDirection(), property, isIgnoreCase(), getNullHandling(), this.unsafe));
425423
}
426424

427425
return Sort.by(orders);
428426
}
429427

430428
@Override
431429
public JpaOrder ignoreCase() {
432-
return new JpaOrder(getDirection(), getProperty(), getNullHandling(), true, this.unsafe);
433-
}
434-
435-
@Override
436-
public boolean isIgnoreCase() {
437-
return super.isIgnoreCase() || ignoreCase;
430+
return new JpaOrder(getDirection(), getProperty(), true, getNullHandling(), this.unsafe);
438431
}
439432

440433
/**

0 commit comments

Comments
 (0)