public class SerializabilityUtil extends Object
Modifier and Type | Field and Description |
---|---|
static Comparator<Field> |
FIELD_COMPARATOR
Comparator used to sort fields.
|
Constructor and Description |
---|
SerializabilityUtil() |
Modifier and Type | Method and Description |
---|---|
static Field[] |
applyFieldSerializationPolicy(Class<?> clazz)
Returns the fields of a particular class that can be considered for
serialization.
|
static SerializedInstanceReference |
decodeSerializedInstanceReference(String encodedSerializedInstanceReference) |
static String |
encodeSerializedInstanceReference(Class<?> instanceType,
SerializationPolicy policy) |
static Type |
findActualType(Type unresolved,
DequeMap<TypeVariable<?>,Type> resolvedTypes)
Resolve type variables to concrete types if possible.
|
static Type[] |
findExpectedParameterTypes(Class<?> instanceClass,
Type expectedType,
DequeMap<TypeVariable<?>,Type> resolvedTypes)
Determine the expected types for any instance type parameters.
|
static Class<?> |
getClassFromType(Type type,
DequeMap<TypeVariable<?>,Type> resolvedTypes)
Find the Class that a given type refers to.
|
static String |
getSerializationSignature(Class<?> instanceType,
SerializationPolicy policy) |
static String |
getSerializedTypeName(Class<?> instanceType) |
static Class<?> |
hasCustomFieldSerializer(Class<?> instanceType)
Returns the
Class which can serialize the given instance type, or
null if this class has no custom field serializer. |
static Class<?> |
hasServerCustomFieldSerializer(Class<?> instanceType)
Returns the server-side
Class which can serialize the given
instance type, or null if this class has no type-checking
custom field serializer. |
static void |
releaseTypes(Type methodType,
DequeMap<TypeVariable<?>,Type> resolvedTypes)
Remove all of the actual types that arose from the given type.
|
static void |
resolveTypes(Type methodType,
DequeMap<TypeVariable<?>,Type> resolvedTypes)
Find all the actual types we can from the information in the given type,
and put the mapping from TypeVariable objects to actual types into the
resolved types map.
|
public static final Comparator<Field> FIELD_COMPARATOR
public static Field[] applyFieldSerializationPolicy(Class<?> clazz)
public static SerializedInstanceReference decodeSerializedInstanceReference(String encodedSerializedInstanceReference)
public static String encodeSerializedInstanceReference(Class<?> instanceType, SerializationPolicy policy)
public static Type findActualType(Type unresolved, DequeMap<TypeVariable<?>,Type> resolvedTypes)
unresolved
- The type to resolveresolvedTypes
- A map of generic types to actual types.public static Type[] findExpectedParameterTypes(Class<?> instanceClass, Type expectedType, DequeMap<TypeVariable<?>,Type> resolvedTypes)
instanceClass
- The instance for which we want generic parameter typesexpectedType
- The type we are expecting this instance to beresolvedTypes
- The types that have been resolved to actual valuespublic static Class<?> getClassFromType(Type type, DequeMap<TypeVariable<?>,Type> resolvedTypes)
type
- The type of interestpublic static String getSerializationSignature(Class<?> instanceType, SerializationPolicy policy)
public static Class<?> hasCustomFieldSerializer(Class<?> instanceType)
Class
which can serialize the given instance type, or
null
if this class has no custom field serializer.
Note that arrays never have custom field serializers.public static Class<?> hasServerCustomFieldSerializer(Class<?> instanceType)
Class
which can serialize the given
instance type, or null
if this class has no type-checking
custom field serializer.
Note that arrays never have custom field serializers.public static void releaseTypes(Type methodType, DequeMap<TypeVariable<?>,Type> resolvedTypes)
methodType
- The type we wish to assign this instance toresolvedTypes
- The types that have been resolved to actual valuespublic static void resolveTypes(Type methodType, DequeMap<TypeVariable<?>,Type> resolvedTypes)
methodType
- The type we wish to assign this instance toresolvedTypes
- The types that have been resolved to actual valuesCopyright © 2018. All rights reserved.