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 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. |
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.Copyright © 2017. All Rights Reserved.