Skip to content

Commit 04f59f1

Browse files
mp911dechristophstrobl
authored andcommitted
DATACMNS-1762 - Extract NullableWrapperConverters from QueryExecutionConverters.
Nullable wrappers such as Java 8 Optional, Guava Optional, Scala Option and Vavr Option are now handled in NullableWrapperConverters and are no longer coupled to QueryExecutionConverters so that this functionality can be reused. Original Pull Request: #459
1 parent 9ced611 commit 04f59f1

File tree

6 files changed

+810
-306
lines changed

6 files changed

+810
-306
lines changed

src/main/java/org/springframework/data/repository/core/support/QueryExecutionResultHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
import org.springframework.core.convert.ConversionService;
2828
import org.springframework.core.convert.TypeDescriptor;
2929
import org.springframework.core.convert.support.GenericConversionService;
30-
import org.springframework.data.repository.util.NullableWrapper;
3130
import org.springframework.data.repository.util.QueryExecutionConverters;
3231
import org.springframework.data.repository.util.ReactiveWrapperConverters;
32+
import org.springframework.data.util.NullableWrapper;
3333
import org.springframework.data.util.Streamable;
3434
import org.springframework.lang.Nullable;
3535

src/main/java/org/springframework/data/repository/util/NullableWrapper.java

+5-26
Original file line numberDiff line numberDiff line change
@@ -23,41 +23,20 @@
2323
* convert {@literal null} into an object of some sort.
2424
*
2525
* @author Oliver Gierke
26+
* @author Mark Paluch
2627
* @since 1.8
2728
* @see QueryExecutionConverters
29+
* @deprecated since 2.4, use {@link org.springframework.data.util.NullableWrapper} instead.
2830
*/
29-
public class NullableWrapper {
30-
31-
private final @Nullable Object value;
31+
@Deprecated
32+
public class NullableWrapper extends org.springframework.data.util.NullableWrapper {
3233

3334
/**
3435
* Creates a new {@link NullableWrapper} for the given value.
3536
*
3637
* @param value can be {@literal null}.
3738
*/
3839
public NullableWrapper(@Nullable Object value) {
39-
this.value = value;
40-
}
41-
42-
/**
43-
* Returns the type of the contained value. WIll fall back to {@link Object} in case the value is {@literal null}.
44-
*
45-
* @return will never be {@literal null}.
46-
*/
47-
public Class<?> getValueType() {
48-
49-
Object value = this.value;
50-
51-
return value == null ? Object.class : value.getClass();
52-
}
53-
54-
/**
55-
* Returns the backing value.
56-
*
57-
* @return the value can be {@literal null}.
58-
*/
59-
@Nullable
60-
public Object getValue() {
61-
return value;
40+
super(value);
6241
}
6342
}

0 commit comments

Comments
 (0)