abstract class SerializableTypeWrapper extends Object
Serializable
variants of Types.
Fields or MethodParameters can be used as the root source for a serializable type.
Alternatively the superclass,
interfaces or type parameters or a regular Class can also be used as source.
The returned type will either be a Class or a serializable proxy of
GenericArrayType, ParameterizedType, TypeVariable or
WildcardType. With the exception of Class (which is final) calls
to methods that return further Types (for example
GenericArrayType.getGenericComponentType()) will be automatically wrapped.
| 限定符和类型 | 类和说明 |
|---|---|
(专用程序包) static class |
SerializableTypeWrapper.FieldTypeProvider
|
(专用程序包) static class |
SerializableTypeWrapper.MethodInvokeTypeProvider
SerializableTypeWrapper.TypeProvider for Types obtained by invoking a no-arg method. |
(专用程序包) static class |
SerializableTypeWrapper.MethodParameterTypeProvider
|
(专用程序包) static interface |
SerializableTypeWrapper.SerializableTypeProxy
Additional interface implemented by the type proxy.
|
(专用程序包) static interface |
SerializableTypeWrapper.TypeProvider
A
Serializable interface providing access to a Type. |
| 限定符和类型 | 字段和说明 |
|---|---|
(专用程序包) static ConcurrentReferenceHashMap<Type,Type> |
cache |
| 构造器和说明 |
|---|
SerializableTypeWrapper() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Type |
forField(Field field)
Return a
Serializable variant of Field.getGenericType(). |
static Type[] |
forGenericInterfaces(Class<?> type)
Return a
Serializable variant of Class.getGenericInterfaces(). |
static Type |
forGenericSuperclass(Class<?> type)
Return a
Serializable variant of Class.getGenericSuperclass(). |
static Type |
forMethodParameter(MethodParameter methodParameter)
Return a
Serializable variant of
MethodParameter.getGenericParameterType(). |
static Type[] |
forTypeParameters(Class<?> type)
Return a
Serializable variant of Class.getTypeParameters(). |
(专用程序包) static Type |
forTypeProvider(SerializableTypeWrapper.TypeProvider provider)
|
static <T extends Type> |
unwrap(T type)
Unwrap the given type, effectively returning the original non-serializable type.
|
static final ConcurrentReferenceHashMap<Type,Type> cache
public static Type forField(Field field)
Serializable variant of Field.getGenericType().public static Type forMethodParameter(MethodParameter methodParameter)
Serializable variant of
MethodParameter.getGenericParameterType().public static Type forGenericSuperclass(Class<?> type)
Serializable variant of Class.getGenericSuperclass().public static Type[] forGenericInterfaces(Class<?> type)
Serializable variant of Class.getGenericInterfaces().public static Type[] forTypeParameters(Class<?> type)
Serializable variant of Class.getTypeParameters().public static <T extends Type> T unwrap(T type)
type - the type to unwrapstatic Type forTypeProvider(SerializableTypeWrapper.TypeProvider provider)
Copyright © 2020. All rights reserved.