Package org.jboss.marshalling
Class ModularClassTable
- java.lang.Object
-
- org.jboss.marshalling.ModularClassTable
-
- All Implemented Interfaces:
ClassTable
public final class ModularClassTable extends java.lang.Object implements ClassTable
A class table which implements an alternate class resolution strategy based on JBoss Modules. Each class name is stored along with its corresponding module identifier, which allows the object graph to be exactly reconstituted on the remote side. This class should only be used when the marshalling and unmarshalling side share the same class files.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ModularClassTable.ClassWriter
private static class
ModularClassTable.ProxyWriter
-
Nested classes/interfaces inherited from interface org.jboss.marshalling.ClassTable
ClassTable.Writer
-
-
Field Summary
Fields Modifier and Type Field Description private static ClassTable.Writer
CLASS_WRITER
private org.jboss.modules.ModuleLoader
moduleLoader
private static ClassTable.Writer
PROXY_WRITER
-
Constructor Summary
Constructors Modifier Constructor Description private
ModularClassTable(org.jboss.modules.ModuleLoader moduleLoader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClassTable.Writer
getClassWriter(java.lang.Class<?> clazz)
Determine whether the given class reference is a valid predefined reference.static ModularClassTable
getInstance(org.jboss.modules.ModuleLoader moduleLoader)
Get an instance using the given module loader.java.lang.Class<?>
readClass(Unmarshaller unmarshaller)
Read a class from the stream.
-
-
-
Field Detail
-
PROXY_WRITER
private static final ClassTable.Writer PROXY_WRITER
-
CLASS_WRITER
private static final ClassTable.Writer CLASS_WRITER
-
moduleLoader
private final org.jboss.modules.ModuleLoader moduleLoader
-
-
Method Detail
-
getInstance
public static ModularClassTable getInstance(org.jboss.modules.ModuleLoader moduleLoader)
Get an instance using the given module loader.- Parameters:
moduleLoader
- the module loader to use- Returns:
- the modular class table
-
getClassWriter
public ClassTable.Writer getClassWriter(java.lang.Class<?> clazz) throws java.io.IOException
Determine whether the given class reference is a valid predefined reference.- Specified by:
getClassWriter
in interfaceClassTable
- Parameters:
clazz
- the candidate class- Returns:
- the class writer, or
null
to use the default mechanism - Throws:
java.io.IOException
- if an I/O error occurs
-
readClass
public java.lang.Class<?> readClass(Unmarshaller unmarshaller) throws java.io.IOException, java.lang.ClassNotFoundException
Read a class from the stream. The class will have been written by theClassTable.getClassWriter(Class)
method'sWriter
instance, as defined above.- Specified by:
readClass
in interfaceClassTable
- Parameters:
unmarshaller
- the unmarshaller to read from- Returns:
- the class
- Throws:
java.io.IOException
- if an I/O error occursjava.lang.ClassNotFoundException
- if a class could not be found
-
-