Polishing.
Reduce TypeDiscoverer.isNullableWrapper method visibility to private to avoid exposure in preparation for wider value type support. Original pull request: #2394. See #2390.
This commit is contained in:
@@ -25,7 +25,16 @@ import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.lang.reflect.TypeVariable;
|
||||
import java.lang.reflect.WildcardType;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -309,6 +318,8 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
return getComponentType();
|
||||
}
|
||||
|
||||
// TODO: Consider that we will support value types beyond Optional<T>, such as Json<T>, Foo<T> that should remain
|
||||
// configurable.
|
||||
if (isNullableWrapper()) {
|
||||
return getComponentType();
|
||||
}
|
||||
@@ -529,6 +540,10 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
throw new IllegalArgumentException(String.format("Type %s not contained in candidates %s!", type, candidates));
|
||||
}
|
||||
|
||||
private boolean isNullableWrapper() {
|
||||
return NullableWrapperConverters.supports(getType());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
|
||||
@@ -274,13 +274,4 @@ public interface TypeInformation<S> {
|
||||
return !type.equals(getType()) && type.isAssignableFrom(getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the current type is considered a {@literal null} value wrapper or not.
|
||||
*
|
||||
* @return {@literal true} if the type is considered to be a {@literal null} value wrapper such as {@link java.util.Optional}.
|
||||
*/
|
||||
default boolean isNullableWrapper() {
|
||||
return NullableWrapperConverters.supports(getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user