Class AbstractObjectTransferable<S>

    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractObjectTransferable​(S source, java.lang.Class<?>... objectClasses)
      Source and object esclass constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canTransfer​(com.globalmentor.net.ContentType contentType)
      Determines whether this transferable can transfer data with the given content type.
      protected java.lang.Class<?> getClass​(com.globalmentor.net.ContentType contentType)
      Determines the class this content type matches.
      com.globalmentor.net.ContentType[] getContentTypes()
      S getSource()  
      java.lang.Object transfer​(com.globalmentor.net.ContentType contentType)
      Transfers data using the given content type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractObjectTransferable

        public AbstractObjectTransferable​(S source,
                                          java.lang.Class<?>... objectClasses)
        Source and object esclass constructor.
        Parameters:
        source - The source of the transferable data.
        objectClasses - The classes indicating the typees of object to be transferred.
        Throws:
        java.lang.NullPointerException - if the provided source and/or object classes is null.
    • Method Detail

      • getSource

        public S getSource()
        Specified by:
        getSource in interface Transferable<S>
        Returns:
        The source of the transferable data.
      • getClass

        protected java.lang.Class<?> getClass​(com.globalmentor.net.ContentType contentType)
        Determines the class this content type matches. This method matches a content type against the "application" primary type and "x-java-object" subtype, with a "class" parameter indicating the given object class.
        Parameters:
        contentType - The type of data requested, which may include wildcards.
        Returns:
        The matching class, or null if no supported class matches the requested content type.
      • canTransfer

        public boolean canTransfer​(com.globalmentor.net.ContentType contentType)
        Determines whether this transferable can transfer data with the given content type.

        This implementation matches a content type against the "application" primary type and "x-java-object" subtype, with a "class" parameter indicating the given object class.

        Specified by:
        canTransfer in interface Transferable<S>
        Parameters:
        contentType - The type of data requested, which may include wildcards.
        Returns:
        true if this object can transfer data with the requested content type.
      • transfer

        public java.lang.Object transfer​(com.globalmentor.net.ContentType contentType)
        Transfers data using the given content type.

        This implementation delegates to Transferable.transfer(Class).

        Specified by:
        transfer in interface Transferable<S>
        Parameters:
        contentType - The type of data expected.
        Returns:
        The transferred data, which may be null.
      • getContentTypes

        public com.globalmentor.net.ContentType[] getContentTypes()

        This implementation returns content types in the form application/x-java-object;class=package.Class.

        Specified by:
        getContentTypes in interface Transferable<S>
        Returns:
        The content types available for this transfer.