JBoss Marshalling 1.3.0.CR9

org.jboss.marshalling
Interface ClassResolver

All Known Implementing Classes:
AbstractClassResolver, ContextClassResolver, ModularClassResolver, SimpleClassResolver

public interface ClassResolver

A class annotator and resolver. Instances of this interface have the opportunity to append information (such as classloader information, or class bytes) to a written class descriptor. This information can then be used on unmarshalling to aid in the selection (or creation) of the proper Class based on the class descriptor and the annotation data.


Method Summary
 void annotateClass(Marshaller marshaller, Class<?> clazz)
          Add optional information about a class to a stream.
 void annotateProxyClass(Marshaller marshaller, Class<?> proxyClass)
          Add optional information about a proxy class to a stream.
 String getClassName(Class<?> clazz)
          Get the class name to write for a given class.
 String[] getProxyInterfaces(Class<?> proxyClass)
          Get the interface names to write for a given proxy class.
 Class<?> resolveClass(Unmarshaller unmarshaller, String name, long serialVersionUID)
          Load the local class for a class descriptor.
 Class<?> resolveProxyClass(Unmarshaller unmarshaller, String[] interfaces)
          Load a proxy class that implements the given interfaces.
 

Method Detail

annotateClass

void annotateClass(Marshaller marshaller,
                   Class<?> clazz)
                   throws IOException
Add optional information about a class to a stream. The class descriptor will already have been written.

Parameters:
marshaller - the marshaller to write to
clazz - the class that was written
Throws:
IOException - if an error occurs
See Also:
ObjectOutputStream.annotateClass(Class)

annotateProxyClass

void annotateProxyClass(Marshaller marshaller,
                        Class<?> proxyClass)
                        throws IOException
Add optional information about a proxy class to a stream. The class descriptor will already have been written.

Parameters:
marshaller - the marshaller to write to
proxyClass - the class that was written
Throws:
IOException - if an error occurs
See Also:
ObjectOutputStream.annotateProxyClass(Class)

getClassName

String getClassName(Class<?> clazz)
                    throws IOException
Get the class name to write for a given class. The class name will be written as part of the class descriptor.

Parameters:
clazz - the class
Returns:
the class name
Throws:
IOException - if an error occurs

getProxyInterfaces

String[] getProxyInterfaces(Class<?> proxyClass)
                            throws IOException
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 - the proxy class
Returns:
the proxy class interface names
Throws:
IOException - if an error occurs

resolveClass

Class<?> resolveClass(Unmarshaller unmarshaller,
                      String name,
                      long serialVersionUID)
                      throws IOException,
                             ClassNotFoundException
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 - the unmarshaller from which to read annotation data, if any
name - the class name
serialVersionUID - the serial version UID
Returns:
the corresponding class
Throws:
IOException - if an I/O error occurs
ClassNotFoundException - if the class could not be loaded
See Also:
ObjectInputStream.resolveClass(java.io.ObjectStreamClass)

resolveProxyClass

Class<?> resolveProxyClass(Unmarshaller unmarshaller,
                           String[] interfaces)
                           throws IOException,
                                  ClassNotFoundException
Load a proxy class that implements the given interfaces.

Parameters:
unmarshaller - the unmarshaller from which to read annotation data, if any
interfaces - the class descriptor
Returns:
the proxy class
Throws:
IOException - if an I/O error occurs
ClassNotFoundException - if the proxy class could not be loaded
See Also:
ObjectInputStream.resolveProxyClass(String[])

JBoss Marshalling 1.3.0.CR9

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