Package org.jboss.marshalling
Class ModularClassResolver
java.lang.Object
org.jboss.marshalling.ModularClassResolver
- All Implemented Interfaces:
ClassResolver
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ClassLoader
private final org.jboss.modules.ModuleLoader
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
ModularClassResolver
(org.jboss.modules.ModuleLoader moduleLoader) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.getClassName
(Class<?> clazz) Get the class name to write for a given class.static ModularClassResolver
getInstance
(org.jboss.modules.ModuleLoader moduleLoader) Construct a new instance using the given module loader.String[]
getProxyInterfaces
(Class<?> proxyClass) Get the interface names to write for a given proxy class.Class
<?> resolveClass
(Unmarshaller unmarshaller, String className, long serialVersionUID) Load the local class for a class descriptor.Class
<?> resolveProxyClass
(Unmarshaller unmarshaller, String[] names) Load a proxy class that implements the given interfaces.
-
Field Details
-
moduleLoader
private final org.jboss.modules.ModuleLoader moduleLoader -
MODULE_CLASS_LOADER
-
-
Constructor Details
-
ModularClassResolver
private ModularClassResolver(org.jboss.modules.ModuleLoader moduleLoader)
-
-
Method Details
-
getInstance
Construct a new instance using the given module loader.- Parameters:
moduleLoader
- the module loader- Returns:
- the new instance
-
annotateClass
Add optional information about a class to a stream. The class descriptor will already have been written.- Specified by:
annotateClass
in interfaceClassResolver
- Parameters:
marshaller
- the marshaller to write toclazz
- the class that was written- Throws:
IOException
- if an error occurs- See Also:
-
annotateProxyClass
Add optional information about a proxy class to a stream. The class descriptor will already have been written.- Specified by:
annotateProxyClass
in interfaceClassResolver
- Parameters:
marshaller
- the marshaller to write toproxyClass
- the class that was written- Throws:
IOException
- if an error occurs- See Also:
-
getClassName
Get the class name to write for a given class. The class name will be written as part of the class descriptor.- Specified by:
getClassName
in interfaceClassResolver
- Parameters:
clazz
- the class- Returns:
- the class name
- Throws:
IOException
- if an error occurs
-
getProxyInterfaces
Get the interface names to write for a given proxy class. The interface names will be written as part of the class descriptor.- Specified by:
getProxyInterfaces
in interfaceClassResolver
- Parameters:
proxyClass
- the proxy class- Returns:
- the proxy class interface names
- Throws:
IOException
- if an error occurs
-
resolveClass
public Class<?> resolveClass(Unmarshaller unmarshaller, String className, long serialVersionUID) throws IOException, ClassNotFoundException Load the local class for a class descriptor. The class descriptor has already been read, but any data written byClassResolver.annotateClass(Marshaller, Class)
should be read by this method.- Specified by:
resolveClass
in interfaceClassResolver
- Parameters:
unmarshaller
- the unmarshaller from which to read annotation data, if anyclassName
- 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:
-
resolveProxyClass
public Class<?> resolveProxyClass(Unmarshaller unmarshaller, String[] names) throws IOException, ClassNotFoundException Load a proxy class that implements the given interfaces.- Specified by:
resolveProxyClass
in interfaceClassResolver
- Parameters:
unmarshaller
- the unmarshaller from which to read annotation data, if anynames
- 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:
-