Top Description Fields Constructors Methods
org.jboss.marshalling

public abstract Class AbstractClassResolver

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

A base implementation of ClassResolver which simply resolves the class against a classloader which is specified by the subclass implementation.

Field Summary

Modifier and TypeField and Description
protected final boolean
enforceSerialVersionUid

Specifies whether an exception should be thrown on an incorrect serialVersionUID.

private static final Map<String, Class<?>>
private static final SerializableClassRegistry

Constructor Summary

AccessConstructor and Description
protected
AbstractClassResolver()

Construct a new instance.

protected
AbstractClassResolver(final boolean
true if an exception should be thrown on an incorrect serialVersionUID
enforceSerialVersionUid
)

Construct a new instance.

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.
protected abstract ClassLoader

Returns:

the classloader
getClassLoader
()

Get the classloader to use to resolve classes for this resolver.

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 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.
protected Class<?>

Returns:

the class
loadClass
(final String
the name of the class
name
)

Load a class with the given name.

public Class<?>
resolveClass(final Unmarshaller
the unmarshaller from which to read annotation data, if any
unmarshaller
,
final String
the class name
name
,
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
interfaces
)

Implements org.jboss.marshalling.ClassResolver.resolveProxyClass.

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

Field Detail

enforceSerialVersionUidback to summary
protected final boolean enforceSerialVersionUid

Specifies whether an exception should be thrown on an incorrect serialVersionUID.

primitivesback to summary
private static final Map<String, Class<?>> primitives
registryback to summary
private static final SerializableClassRegistry registry

Constructor Detail

AbstractClassResolverback to summary
protected AbstractClassResolver()

Construct a new instance.

AbstractClassResolverback to summary
protected AbstractClassResolver(final boolean enforceSerialVersionUid)

Construct a new instance.

Parameters
enforceSerialVersionUid:boolean

true if an exception should be thrown on an incorrect serialVersionUID

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. The base implementation takes no action.

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. The base implementation takes no action.

Parameters
marshaller:Marshaller

the marshaller to write to

proxyClass:Class<?>

the class that was written

Exceptions
IOException:
if an error occurs
getClassLoaderback to summary
protected abstract ClassLoader getClassLoader()

Get the classloader to use to resolve classes for this resolver.

Returns:ClassLoader

the classloader

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. The base implementation returns the name of the class.

Parameters
clazz:Class<?>

the class

Returns:String

the class name

Exceptions
IOException:
if an error occurs
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. The base implementation returns the name of each interface (via getClassName() implemented by the given class.

Parameters
proxyClass:Class<?>

the proxy class

Returns:String[]

the proxy class interface names

Exceptions
IOException:
if an error occurs
loadClassback to summary
protected Class<?> loadClass(final String name) throws ClassNotFoundException

Load a class with the given name. The base implementation uses the classloader returned from getClassLoader().

Parameters
name:String

the name of the class

Returns:Class<?>

the class

Exceptions
ClassNotFoundException:
if the class is not found, or if there is no classloader
resolveClassback to summary
public Class<?> resolveClass(final Unmarshaller unmarshaller, final String name, 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. The base implementation uses the class loader returned from getClassLoader() and loads the class by name.

Parameters
unmarshaller:Unmarshaller

the unmarshaller from which to read annotation data, if any

name: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[] interfaces) 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. The base implementation uses the class loader returned from getClassLoader() and loads each interface by name, returning a proxy class from that class loader.

Parameters
unmarshaller:Unmarshaller

the unmarshaller from which to read annotation data, if any

interfaces: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