public abstract class ClassScanningSerializerIds extends java.lang.Object implements SerializerIds
Class<?>
objects
and vice versa.
This SerializerIds
operates by scanning a supplied list of classes.
Modifier | Constructor and Description |
---|---|
protected |
ClassScanningSerializerIds(java.util.Collection<java.lang.Class<?>> classes)
Scan for all classes with an
SerializerId annotation
in the specified set of classes. |
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
getClassForId(java.lang.String id)
Return an object's class, given the ID.
|
java.lang.String |
getIdForClass(java.lang.Class<?> cls)
Return the serializer ID, or
null if no serializer known. |
boolean |
isSerializableSuper(java.lang.Class<?> cls)
Return true if class is serializable, or a supertype of
a serializable class, excluding
Object . |
protected ClassScanningSerializerIds(java.util.Collection<java.lang.Class<?>> classes)
SerializerId
annotation
in the specified set of classes.classes
- The list of classes to scan for serialization annotationsSerializerIdsException
- If two or more classes are
found with the same SerializerId
public java.lang.String getIdForClass(java.lang.Class<?> cls)
SerializerIds
null
if no serializer known.getIdForClass
in interface SerializerIds
cls
- The class to retrieve the serializer ID for.null
if no serializer known.public java.lang.Class<?> getClassForId(java.lang.String id)
SerializerIds
null
is returned.getClassForId
in interface SerializerIds
id
- The serializer ID to find the mapped class for.null
if serializer ID unknown.public boolean isSerializableSuper(java.lang.Class<?> cls)
SerializerIds
Object
.isSerializableSuper
in interface SerializerIds
cls
- The class to checktrue
if class is serializable, or a supertype