JBoss Marshalling 1.3.0.CR9

org.jboss.marshalling
Class ModularClassTable

java.lang.Object
  extended by org.jboss.marshalling.ModularClassTable
All Implemented Interfaces:
ClassTable

public final class ModularClassTable
extends 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.

Author:
David M. Lloyd

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.marshalling.ClassTable
ClassTable.Writer
 
Method Summary
 ClassTable.Writer getClassWriter(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.
 Class<?> readClass(Unmarshaller unmarshaller)
          Read a class from the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(Class<?> clazz)
                                 throws IOException
Determine whether the given class reference is a valid predefined reference.

Specified by:
getClassWriter in interface ClassTable
Parameters:
clazz - the candidate class
Returns:
the class writer, or null to use the default mechanism
Throws:
IOException - if an I/O error occurs

readClass

public Class<?> readClass(Unmarshaller unmarshaller)
                   throws IOException,
                          ClassNotFoundException
Read a class from the stream. The class will have been written by the ClassTable.getClassWriter(Class) method's Writer instance, as defined above.

Specified by:
readClass in interface ClassTable
Parameters:
unmarshaller - the unmarshaller to read from
Returns:
the class
Throws:
IOException - if an I/O error occurs
ClassNotFoundException - if a class could not be found

JBoss Marshalling 1.3.0.CR9

Copyright © 2011 JBoss, a division of Red Hat, Inc.