Top Description Fields Constructors Methods
org.jboss.marshalling

public final Class ModularClassResolver

extends Object
implements ClassResolver
Class Inheritance
All Implemented Interfaces
org.jboss.marshalling.ClassResolver
Static Imports
java.lang.System.getSecurityManager, java.security.AccessController.doPrivileged

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 be used when the marshalling and unmarshalling side may have differing class files.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private static final ClassLoader
private final ModuleLoader

Constructor Summary

AccessConstructor and Description
private
ModularClassResolver(final ModuleLoader moduleLoader)

Method Summary

Modifier and TypeMethod and Description
public void
annotateClass(final Marshaller
the marshaller to write to
marshaller
,
final Class<?>
the class that was written
clazz
)

Implements org.jboss.marshalling.ClassResolver.annotateClass.

Add optional information about a class to a stream.
public void
annotateProxyClass(final Marshaller
the marshaller to write to
marshaller
,
final Class<?>
the class that was written
proxyClass
)

Implements org.jboss.marshalling.ClassResolver.annotateProxyClass.

Add optional information about a proxy class to a stream.
public String
getClassName(final Class<?>
the class
clazz
)

Implements org.jboss.marshalling.ClassResolver.getClassName.

Get the class name to write for a given class.
public static ModularClassResolver

Returns:

the new instance
getInstance
(final ModuleLoader
the module loader
moduleLoader
)

Construct a new instance using the given module loader.

public String[]
getProxyInterfaces(final Class<?>
the proxy class
proxyClass
)

Implements org.jboss.marshalling.ClassResolver.getProxyInterfaces.

Get the interface names to write for a given proxy class.
public Class<?>
resolveClass(final Unmarshaller
the unmarshaller from which to read annotation data, if any
unmarshaller
,
final String
the class name
className
,
final long
the serial version UID
serialVersionUID
)

Implements org.jboss.marshalling.ClassResolver.resolveClass.

Load the local class for a class descriptor.
public Class<?>
resolveProxyClass(final Unmarshaller
the unmarshaller from which to read annotation data, if any
unmarshaller
,
final String[]
the class descriptor
names
)

Implements org.jboss.marshalling.ClassResolver.resolveProxyClass.

Load a proxy class that implements the given interfaces.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MODULE_CLASS_LOADERback to summary
private static final ClassLoader MODULE_CLASS_LOADER
moduleLoaderback to summary
private final ModuleLoader moduleLoader

Constructor Detail

ModularClassResolverback to summary
private ModularClassResolver(final ModuleLoader moduleLoader)

Method Detail

annotateClassback to summary
public void annotateClass(final Marshaller marshaller, final Class<?> clazz) throws IOException

Implements org.jboss.marshalling.ClassResolver.annotateClass.

Doc from org.jboss.marshalling.ClassResolver.annotateClass.

Add optional information about a class to a stream. The class descriptor will already have been written.

Parameters
marshaller:Marshaller

the marshaller to write to

clazz:Class<?>

the class that was written

Exceptions
IOException:
if an error occurs
annotateProxyClassback to summary
public void annotateProxyClass(final Marshaller marshaller, final Class<?> proxyClass) throws IOException

Implements org.jboss.marshalling.ClassResolver.annotateProxyClass.

Doc from org.jboss.marshalling.ClassResolver.annotateProxyClass.

Add optional information about a proxy class to a stream. The class descriptor will already have been written.

Parameters
marshaller:Marshaller

the marshaller to write to

proxyClass:Class<?>

the class that was written

Exceptions
IOException:
if an error occurs
getClassNameback to summary
public String getClassName(final Class<?> clazz) throws IOException

Implements org.jboss.marshalling.ClassResolver.getClassName.

Doc from org.jboss.marshalling.ClassResolver.getClassName.

Get the class name to write for a given class. The class name will be written as part of the class descriptor.

Parameters
clazz:Class<?>

the class

Returns:String

the class name

Exceptions
IOException:
if an error occurs
getInstanceback to summary
public static ModularClassResolver getInstance(final ModuleLoader moduleLoader)

Construct a new instance using the given module loader.

Parameters
moduleLoader:ModuleLoader

the module loader

Returns:ModularClassResolver

the new instance

getProxyInterfacesback to summary
public String[] getProxyInterfaces(final Class<?> proxyClass) throws IOException

Implements org.jboss.marshalling.ClassResolver.getProxyInterfaces.

Doc from org.jboss.marshalling.ClassResolver.getProxyInterfaces.

Get the interface names to write for a given proxy class. The interface names will be written as part of the class descriptor.

Parameters
proxyClass:Class<?>

the proxy class

Returns:String[]

the proxy class interface names

Exceptions
IOException:
if an error occurs
resolveClassback to summary
public Class<?> resolveClass(final Unmarshaller unmarshaller, final String className, final long serialVersionUID) throws IOException, ClassNotFoundException

Implements org.jboss.marshalling.ClassResolver.resolveClass.

Doc from org.jboss.marshalling.ClassResolver.resolveClass.

Load the local class for a class descriptor. The class descriptor has already been read, but any data written by annotateClass(Marshaller, Class) should be read by this method.

Parameters
unmarshaller:Unmarshaller

the unmarshaller from which to read annotation data, if any

className:String

the class name

serialVersionUID:long

the serial version UID

Returns:Class<?>

the corresponding class

Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if the class could not be loaded
resolveProxyClassback to summary
public Class<?> resolveProxyClass(final Unmarshaller unmarshaller, final String[] names) throws IOException, ClassNotFoundException

Implements org.jboss.marshalling.ClassResolver.resolveProxyClass.

Doc from org.jboss.marshalling.ClassResolver.resolveProxyClass.

Load a proxy class that implements the given interfaces.

Parameters
unmarshaller:Unmarshaller

the unmarshaller from which to read annotation data, if any

names:String[]

the class descriptor

Returns:Class<?>

the proxy class

Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if the proxy class could not be loaded