Package org.jboss.marshalling
Interface ClassResolver
-
- All Known Implementing Classes:
AbstractClassResolver,ContextClassResolver,ModularClassResolver,SimpleClassResolver
public interface ClassResolverA 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 properClassbased on the class descriptor and the annotation data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidannotateClass(Marshaller marshaller, Class<?> clazz)Add optional information about a class to a stream.voidannotateProxyClass(Marshaller marshaller, Class<?> proxyClass)Add optional information about a proxy class to a stream.StringgetClassName(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 toclazz- 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 toproxyClass- 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 byannotateClass(Marshaller, Class)should be read by this method.- Parameters:
unmarshaller- the unmarshaller from which to read annotation data, if anyname- the class nameserialVersionUID- the serial version UID- Returns:
- the corresponding class
- Throws:
IOException- if an I/O error occursClassNotFoundException- 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 anyinterfaces- the class descriptor- Returns:
- the proxy class
- Throws:
IOException- if an I/O error occursClassNotFoundException- if the proxy class could not be loaded- See Also:
ObjectInputStream.resolveProxyClass(String[])
-
-