public class SerializerRegistry extends Object
| Modifier and Type | Field and Description |
|---|---|
private static Map<Class<?>,Serializer<?>> |
serializers |
private static String |
wireName |
| Constructor and Description |
|---|
SerializerRegistry() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getName()
Returns the descriptive name of this factory indicating the utilized wire format.
|
static <T> Serializer<T> |
getSerializer(Class<T> type)
Returns a serializer instance.
|
static boolean |
hasSerializer(Class<?> type)
Returns whether a serializer is known for the given
type. |
static <T> void |
registerSerializer(Class<? extends Serializer<T>> type)
Registers a serializer through its type.
|
static <T> void |
registerSerializer(Serializer<T> serializer)
Registers a serializer.
|
static void |
resetDefaults()
Re-registers the default serizalizer types.
|
static String |
setName(String name)
Changes the descriptive name of this factory indicating the utilized wire format.
|
static void |
unregisterSerializer(Class<?> type)
Unregisters a serializer.
|
static void |
unregisterSerializer(Serializer<?> serializer)
Unregisters a serializer.
|
private static Map<Class<?>,Serializer<?>> serializers
private static String wireName
public static void resetDefaults()
public static <T> Serializer<T> getSerializer(Class<T> type)
T - the data type to be handled by the serializertype - the type to return the serializer forpublic static boolean hasSerializer(Class<?> type)
type.type - the type to query fortrue if there is a registered serizalizer, false elsepublic static <T> void registerSerializer(Class<? extends Serializer<T>> type) throws IllegalArgumentException
type.T - the type to be serializedtype - the type of the serializer to registerIllegalArgumentException - if the required no-arg constructor on type cannot be found, called
or executed, i.e., there is no instance to registerpublic static <T> void registerSerializer(Serializer<T> serializer)
T - the type of the dataserializer - the serializer instance (must not be null)public static void unregisterSerializer(Serializer<?> serializer)
serializer - the serializer instance to unregister (must not be
null)public static void unregisterSerializer(Class<?> type)
type - the serializer type to unregisterpublic static String getName()
Copyright © 2022. All rights reserved.