public abstract class AbstractClassResolver extends java.lang.Object implements ClassResolver
ClassResolver
which simply resolves the class
against a classloader which is specified by the subclass implementation.Modifier and Type | Field and Description |
---|---|
protected boolean |
enforceSerialVersionUid
Specifies whether an exception should be thrown on an incorrect serialVersionUID.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractClassResolver()
Construct a new instance.
|
protected |
AbstractClassResolver(boolean enforceSerialVersionUid)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
annotateClass(Marshaller marshaller,
java.lang.Class<?> clazz)
Add optional information about a class to a stream.
|
void |
annotateProxyClass(Marshaller marshaller,
java.lang.Class<?> proxyClass)
Add optional information about a proxy class to a stream.
|
protected abstract java.lang.ClassLoader |
getClassLoader()
Get the classloader to use to resolve classes for this resolver.
|
java.lang.String |
getClassName(java.lang.Class<?> clazz)
Get the class name to write for a given class.
|
java.lang.String[] |
getProxyInterfaces(java.lang.Class<?> proxyClass)
Get the interface names to write for a given proxy class.
|
protected java.lang.Class<?> |
loadClass(java.lang.String name)
Load a class with the given name.
|
java.lang.Class<?> |
resolveClass(Unmarshaller unmarshaller,
java.lang.String name,
long serialVersionUID)
Load the local class for a class descriptor.
|
java.lang.Class<?> |
resolveProxyClass(Unmarshaller unmarshaller,
java.lang.String[] interfaces)
Load a proxy class that implements the given interfaces.
|
protected final boolean enforceSerialVersionUid
protected AbstractClassResolver()
protected AbstractClassResolver(boolean enforceSerialVersionUid)
enforceSerialVersionUid
- true
if an exception should be thrown on an incorrect serialVersionUIDprotected abstract java.lang.ClassLoader getClassLoader()
public void annotateClass(Marshaller marshaller, java.lang.Class<?> clazz) throws java.io.IOException
annotateClass
in interface ClassResolver
marshaller
- the marshaller to write toclazz
- the class that was writtenjava.io.IOException
- if an error occursObjectOutputStream.annotateClass(Class)
public void annotateProxyClass(Marshaller marshaller, java.lang.Class<?> proxyClass) throws java.io.IOException
annotateProxyClass
in interface ClassResolver
marshaller
- the marshaller to write toproxyClass
- the class that was writtenjava.io.IOException
- if an error occursObjectOutputStream.annotateProxyClass(Class)
public java.lang.String getClassName(java.lang.Class<?> clazz) throws java.io.IOException
getClassName
in interface ClassResolver
clazz
- the classjava.io.IOException
- if an error occurspublic java.lang.String[] getProxyInterfaces(java.lang.Class<?> proxyClass) throws java.io.IOException
getClassName()
implemented by the given class.getProxyInterfaces
in interface ClassResolver
proxyClass
- the proxy classjava.io.IOException
- if an error occurspublic java.lang.Class<?> resolveClass(Unmarshaller unmarshaller, java.lang.String name, long serialVersionUID) throws java.io.IOException, java.lang.ClassNotFoundException
ClassResolver.annotateClass(Marshaller, Class)
should be read by this method. The base implementation uses the class loader returned from getClassLoader()
and
loads the class by name.resolveClass
in interface ClassResolver
unmarshaller
- the unmarshaller from which to read annotation data, if anyname
- the class nameserialVersionUID
- the serial version UIDjava.io.IOException
- if an I/O error occursjava.lang.ClassNotFoundException
- if the class could not be loadedObjectInputStream.resolveClass(java.io.ObjectStreamClass)
protected java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
getClassLoader()
.name
- the name of the classjava.lang.ClassNotFoundException
- if the class is not found, or if there is no classloaderpublic java.lang.Class<?> resolveProxyClass(Unmarshaller unmarshaller, java.lang.String[] interfaces) throws java.io.IOException, java.lang.ClassNotFoundException
getClassLoader()
and loads
each interface by name, returning a proxy class from that class loader.resolveProxyClass
in interface ClassResolver
unmarshaller
- the unmarshaller from which to read annotation data, if anyinterfaces
- the class descriptorjava.io.IOException
- if an I/O error occursjava.lang.ClassNotFoundException
- if the proxy class could not be loadedObjectInputStream.resolveProxyClass(String[])
Copyright © 2011 JBoss, a division of Red Hat, Inc.