Interface ClassCatalog
- All Known Implementing Classes:
StoredClassCatalog
A catalog is used to store class descriptions separately from serialized
objects, to avoid redundantly stored information with each object.
When serialized objects are stored in a database, a StoredClassCatalog should be used.
This information is used for serialization of class descriptors or
java.io.ObjectStreamClass objects, each of which represents a unique class
format. For each unique format, a unique class ID is assigned by the
catalog. The class ID can then be used in the serialization stream in place
of the full class information. When used with SerialInput and
SerialOutput or any of the serial bindings, the use of the catalog
is transparent to the application.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close a catalog database and release any cached resources.getClassFormat(byte[] classID) Return the ObjectStreamClass for the given class ID.byte[]getClassID(ObjectStreamClass classDesc) Return the class ID for the current version of the given class description.Returns the ClassLoader to be used by bindings that use this catalog.
-
Method Details
-
close
Close a catalog database and release any cached resources.- Throws:
DatabaseException
-
getClassID
Return the class ID for the current version of the given class description. This is used for storing in serialization streams in place of a full class descriptor, since it is much more compact. To get back the ObjectStreamClass for a class ID, callgetClassFormat(byte[]). This function causes a new class ID to be assigned if the class description has changed.- Parameters:
classDesc- The class description for which to return the class ID.- Returns:
- The class ID for the current version of the class.
- Throws:
DatabaseExceptionClassNotFoundException
-
getClassFormat
Return the ObjectStreamClass for the given class ID. This may or may not be the current class format, depending on whether the class has changed since the class ID was generated.- Parameters:
classID- The class ID for which to return the class format.- Returns:
- The class format for the given class ID, which may or may not represent the current version of the class.
- Throws:
DatabaseExceptionClassNotFoundException
-
getClassLoader
ClassLoader getClassLoader()Returns the ClassLoader to be used by bindings that use this catalog. The ClassLoader is used bySerialBindingto load classes whose description is stored in the catalog.In BDB JE, the implementation of this method in
StoredClassCatalogreturns the ClassLoader property of the catalog database Environment. This ensures that the Environment's ClassLoader property is used for loading all user-supplied classes.
-