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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method 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.
      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.
      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.
    • Method Detail

      • annotateClass

        void annotateClass​(Marshaller marshaller,
                           java.lang.Class<?> clazz)
                    throws java.io.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:
        java.io.IOException - if an error occurs
        See Also:
        ObjectOutputStream.annotateClass(Class)
      • annotateProxyClass

        void annotateProxyClass​(Marshaller marshaller,
                                java.lang.Class<?> proxyClass)
                         throws java.io.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:
        java.io.IOException - if an error occurs
        See Also:
        ObjectOutputStream.annotateProxyClass(Class)
      • getClassName

        java.lang.String getClassName​(java.lang.Class<?> clazz)
                               throws java.io.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:
        java.io.IOException - if an error occurs
      • getProxyInterfaces

        java.lang.String[] getProxyInterfaces​(java.lang.Class<?> proxyClass)
                                       throws java.io.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:
        java.io.IOException - if an error occurs
      • resolveClass

        java.lang.Class<?> resolveClass​(Unmarshaller unmarshaller,
                                        java.lang.String name,
                                        long serialVersionUID)
                                 throws java.io.IOException,
                                        java.lang.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:
        java.io.IOException - if an I/O error occurs
        java.lang.ClassNotFoundException - if the class could not be loaded
        See Also:
        ObjectInputStream.resolveClass(java.io.ObjectStreamClass)
      • resolveProxyClass

        java.lang.Class<?> resolveProxyClass​(Unmarshaller unmarshaller,
                                             java.lang.String[] interfaces)
                                      throws java.io.IOException,
                                             java.lang.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:
        java.io.IOException - if an I/O error occurs
        java.lang.ClassNotFoundException - if the proxy class could not be loaded
        See Also:
        ObjectInputStream.resolveProxyClass(String[])