@CheckReturnValue public final class Types extends Object
| Modifier and Type | Method and Description |
|---|---|
static GenericArrayType |
arrayOf(Type componentType)
Returns an array type whose elements are all instances of
componentType. |
static Type |
collectionElementType(Type context,
Class<?> contextRawType)
Returns the element type of this collection type.
|
static boolean |
equals(Type a,
Type b)
Returns true if
a and b are equal. |
static Set<? extends Annotation> |
getFieldJsonQualifierAnnotations(Class<?> clazz,
String fieldName) |
static Class<?> |
getRawType(Type type) |
static ParameterizedType |
newParameterizedType(Type rawType,
Type... typeArguments)
Returns a new parameterized type, applying
typeArguments to rawType. |
static ParameterizedType |
newParameterizedTypeWithOwner(Type ownerType,
Type rawType,
Type... typeArguments)
Returns a new parameterized type, applying
typeArguments to rawType. |
static Set<? extends Annotation> |
nextAnnotations(Set<? extends Annotation> annotations,
Class<? extends Annotation> jsonQualifier)
Checks if
annotations contains jsonQualifier. |
static WildcardType |
subtypeOf(Type bound)
Returns a type that represents an unknown type that extends
bound. |
static WildcardType |
supertypeOf(Type bound)
Returns a type that represents an unknown supertype of
bound. |
@Nullable public static Set<? extends Annotation> nextAnnotations(Set<? extends Annotation> annotations, Class<? extends Annotation> jsonQualifier)
annotations contains jsonQualifier.
Returns the subset of annotations without jsonQualifier, or null if annotations does not contain jsonQualifier.public static ParameterizedType newParameterizedType(Type rawType, Type... typeArguments)
typeArguments to rawType. Use this
method if rawType is not enclosed in another type.public static ParameterizedType newParameterizedTypeWithOwner(Type ownerType, Type rawType, Type... typeArguments)
typeArguments to rawType. Use this
method if rawType is enclosed in ownerType.public static GenericArrayType arrayOf(Type componentType)
componentType.public static WildcardType subtypeOf(Type bound)
bound. For example, if
bound is CharSequence.class, this returns ? extends CharSequence. If
bound is Object.class, this returns ?, which is shorthand for ? extends Object.public static WildcardType supertypeOf(Type bound)
bound. For example, if bound is String.class, this returns ? super String.public static Type collectionElementType(Type context, Class<?> contextRawType)
IllegalArgumentException - if this type is not a collection.public static boolean equals(@Nullable Type a, @Nullable Type b)
a and b are equal.public static Set<? extends Annotation> getFieldJsonQualifierAnnotations(Class<?> clazz, String fieldName)
clazz - the target class to read the fieldName field annotations from.fieldName - the target field name on clazz.JsonQualifier-annotated Annotation instances retrieved from
the targeted field. Can be empty if none are found.Copyright © 2018. All rights reserved.