Class AbstractTransferable<S>

    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractTransferable​(S source)
      Source 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.
      S getSource()  
      <T> T transfer​(java.lang.Class<T> objectClass)
      Transfers data of the given class.
      • Methods inherited from class java.lang.Object

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

      • AbstractTransferable

        public AbstractTransferable​(S source)
        Source constructor.
        Parameters:
        source - The source of the transferable data.
        Throws:
        java.lang.NullPointerException - if the provided source is null.
    • Method Detail

      • getSource

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

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

        This implementation calls Transferable.getContentTypes().

        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 <T> T transfer​(java.lang.Class<T> objectClass)
        Transfers data of the given class.

        This implementation delegates to Transferable.transfer(ContentType).

        Specified by:
        transfer in interface Transferable<S>
        Type Parameters:
        T - The type of object to be transferred.
        Parameters:
        objectClass - The class of object to return.
        Returns:
        The transferred data object, which may be null.