public class Types extends Object
| Modifier and Type | Method and Description |
|---|---|
static Type |
getBaseType(Field field)
Determine the "base type" of a field.
|
static Class<? extends Collection<?>> |
getContainerClass(Field field) |
static Type |
getFirstNonOptionalType(Field field)
Get the first complete
Type in a signature that's non-optional, complete with the
information from the ParameterizedType. |
static com.google.common.collect.ImmutableSet<Class<?>> |
getSupertypes(Class<?> clazz)
Returns a Set of classes and interfaces inherited or implemented by clazz.
|
public static Type getBaseType(Field field)
String -> String.class
Optional<String> -> String.class
Set<String> -> String.class
Collection<? extends Comparable> -> Comparable.class
Collection<? super Comparable -> Object.class
@Nullable public static Class<? extends Collection<?>> getContainerClass(Field field)
Collection a field represents, even if contained in an
Optional, but without the ParameterizedType information.public static Type getFirstNonOptionalType(Field field)
Type in a signature that's non-optional, complete with the
information from the ParameterizedType.
public static com.google.common.collect.ImmutableSet<Class<?>> getSupertypes(Class<?> clazz)
Result includes clazz itself. Result is ordered closest to furthest, i.e. first entry will
always be clazz and last entry will always be Object.