public final class CommonTypeUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static @Nullable Class<?> |
getDefinitiveClass(Type type)
Returns the Class equivalent of the type for which there is an absolute class equivalent,
i.e.
|
static Class<?> |
getRawType(ParameterizedType parameterizedType)
Convenience method which returns the raw type of the given parameterized type cast as
Class. |
static boolean |
hasExplicitUpperBound(WildcardType wildcardType)
Returns whether the given wildcard type has an explicitly defined upper bound.
|
public static Class<?> getRawType(ParameterizedType parameterizedType)
Class.
Background: in current JRE versions, the raw type can only be a Class, so the raw type can be cast without checking it beforehand.
parameterizedType - the parameterized type whose raw type should be returnedpublic static boolean hasExplicitUpperBound(WildcardType wildcardType)
Background: the JRE sets the upper bounds to an array with one element of Object.class if the wildcard has lower bounds, or if the wildcard has no specified bounds (i.e. a simple "?").
wildcardType - the wildcard type to analyze@Nullable public static @Nullable Class<?> getDefinitiveClass(Type type)
type - the type to return as class if possibleCopyright © 2023. All rights reserved.