Class SerializerRegistry
java.lang.Object
de.iip_ecosphere.platform.transport.serialization.SerializerRegistry
A registry for serializers to be able to handle also nested types on-demand.
All relevant serializers must be registered for correct functionality.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSomething that provides a serializer. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SerializerRegistry.SerializerProviderprivate static Map<Class<?>, Serializer<?>> private static String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetName()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 booleanhasSerializer(Class<?> type) Returns whether a serializer is known for the giventype.static <T> voidregisterSerializer(Serializer<T> serializer) Registers a serializer.static <T> voidregisterSerializer(Class<? extends Serializer<T>> type) Registers a serializer through its type.static voidRe-registers the default serizalizer types.static StringChanges the descriptive name of this factory indicating the utilized wire format.static voidunregisterSerializer(Serializer<?> serializer) Unregisters a serializer.static voidunregisterSerializer(Class<?> type) Unregisters a serializer.
-
Field Details
-
DEFAULT_PROVIDER
-
serializers
-
wireName
-
-
Constructor Details
-
SerializerRegistry
public SerializerRegistry()
-
-
Method Details
-
resetDefaults
public static void resetDefaults()Re-registers the default serizalizer types. -
getSerializer
Returns a serializer instance.- Type Parameters:
T- the data type to be handled by the serializer- Parameters:
type- the type to return the serializer for- Returns:
- the serializer, null if no such serializer is registered
-
hasSerializer
Returns whether a serializer is known for the giventype.- Parameters:
type- the type to query for- Returns:
trueif there is a registered serizalizer,falseelse
-
registerSerializer
public static <T> void registerSerializer(Class<? extends Serializer<T>> type) throws IllegalArgumentException Registers a serializer through its type. An accessible no-arg constructor is required fortype.- Type Parameters:
T- the type to be serialized- Parameters:
type- the type of the serializer to register- Throws:
IllegalArgumentException- if the required no-arg constructor ontypecannot be found, called or executed, i.e., there is no instance to register
-
registerSerializer
Registers a serializer.- Type Parameters:
T- the type of the data- Parameters:
serializer- the serializer instance (must not be null)
-
unregisterSerializer
Unregisters a serializer.- Parameters:
serializer- the serializer instance to unregister (must not be null)
-
unregisterSerializer
Unregisters a serializer.- Parameters:
type- the serializer type to unregister
-
getName
Returns the descriptive name of this factory indicating the utilized wire format.- Returns:
- the descriptive name
-
setName
Changes the descriptive name of this factory indicating the utilized wire format.- Parameters:
name- the descriptive name- Returns:
- the descriptive name before this call
-