Package se.l4.commons.serialization
Class AbstractSerializerCollection
java.lang.Object
se.l4.commons.serialization.AbstractSerializerCollection
- All Implemented Interfaces:
SerializerCollection
- Direct Known Subclasses:
DefaultSerializerCollection,WrappedSerializerCollection
public abstract class AbstractSerializerCollection extends Object implements SerializerCollection
Default implementation of
SerializerCollection.- Author:
- Andreas Holstenson
-
Constructor Summary
Constructors Constructor Description AbstractSerializerCollection() -
Method Summary
Modifier and Type Method Description SerializerCollectionbind(Class<?> type)Bind a certain type automatically discovering which serializer to use.<T> SerializerCollectionbind(Class<T> type, Serializer<T> serializer)Bind a given type to the specified serializer.protected <T> voidbind(Class<T> type, Serializer<T> serializer, String ns, String name)protected Serializer<?>createVia(SerializerResolver<?> resolver, Type type, Annotation... hints)Create a newSerializerfor the given type and hints via a specificresolverinstance.<T> Serializer<T>find(Class<T> type)Find a serializer suitable for the specific type.<T> Serializer<T>find(Class<T> type, Annotation... hints)Find a serializer suitable for the specific type.Serializer<?>find(String name)Find a serializer based on its registered name.Serializer<?>find(String namespace, String name)Find a serializer based on its registered name.Serializer<?>find(Type type)Find a serializer suitable for the specified type.Serializer<?>find(Type type, Annotation... hints)Find a serializer suitable for the specified type.QualifiedNamefindName(Serializer<?> serializer)Find the name of the given serializer (if any).<T> Serializer<T>findVia(Class<? extends SerializerOrResolver<T>> resolver, Class<T> type, Annotation... hints)Find a serializer using a specificSerializerResolver.<T> Serializer<T>findVia(Class<? extends SerializerOrResolver<T>> resolver, Type type, Annotation... hints)Find a serializer using a specificSerializerResolver.booleanisSupported(Class<?> type)Get if the given type can be serialized.protected voidregisterIfNamed(Class<?> from, Serializer<?> serializer)Register the given serializer if it has a name.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface se.l4.commons.serialization.SerializerCollection
bind, getInstanceFactory, getResolver
-
Constructor Details
-
AbstractSerializerCollection
public AbstractSerializerCollection()
-
-
Method Details
-
bind
-
bind
Description copied from interface:SerializerCollectionBind a certain type automatically discovering which serializer to use.- Specified by:
bindin interfaceSerializerCollection
-
bind
Description copied from interface:SerializerCollectionBind a given type to the specified serializer.- Specified by:
bindin interfaceSerializerCollection
-
find
Description copied from interface:SerializerCollectionFind a serializer suitable for the specific type.- Specified by:
findin interfaceSerializerCollection- Returns:
-
find
Description copied from interface:SerializerCollectionFind a serializer suitable for the specific type.- Specified by:
findin interfaceSerializerCollection- Returns:
-
find
Description copied from interface:SerializerCollectionFind a serializer suitable for the specified type.- Specified by:
findin interfaceSerializerCollection- Returns:
-
find
Description copied from interface:SerializerCollectionFind a serializer suitable for the specified type.- Specified by:
findin interfaceSerializerCollection- Returns:
-
find
Description copied from interface:SerializerCollectionFind a serializer based on its registered name.- Specified by:
findin interfaceSerializerCollection- Returns:
-
find
Description copied from interface:SerializerCollectionFind a serializer based on its registered name.- Specified by:
findin interfaceSerializerCollection- Returns:
-
findVia
public <T> Serializer<T> findVia(Class<? extends SerializerOrResolver<T>> resolver, Class<T> type, Annotation... hints)Description copied from interface:SerializerCollectionFind a serializer using a specificSerializerResolver.- Specified by:
findViain interfaceSerializerCollection- Returns:
-
findVia
public <T> Serializer<T> findVia(Class<? extends SerializerOrResolver<T>> resolver, Type type, Annotation... hints)Description copied from interface:SerializerCollectionFind a serializer using a specificSerializerResolver.- Specified by:
findViain interfaceSerializerCollection- Returns:
-
createVia
Create a newSerializerfor the given type and hints via a specificresolverinstance.- Parameters:
resolver-type-hints-- Returns:
-
findName
Description copied from interface:SerializerCollectionFind the name of the given serializer (if any).- Specified by:
findNamein interfaceSerializerCollection- Returns:
-
isSupported
Description copied from interface:SerializerCollectionGet if the given type can be serialized.- Specified by:
isSupportedin interfaceSerializerCollection- Returns:
-
registerIfNamed
Register the given serializer if it has a name.- Parameters:
from-serializer-
-