Class AbstractTransferable<S>

java.lang.Object
io.guise.framework.component.transfer.AbstractTransferable<S>
Type Parameters:
S - The source of the transfer.
All Implemented Interfaces:
Transferable<S>
Direct Known Subclasses:
AbstractImageComponent.DefaultTransferable, AbstractLabel.DefaultTransferable, TextControl.DefaultTransferable

public abstract class AbstractTransferable<S> extends Object implements Transferable<S>
An abstract object that can be transferred, such as between components using drag and drop.
Author:
Garret Wilson
  • Constructor Details

    • AbstractTransferable

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

    • 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.MediaType 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(Class<T> objectClass)
      Transfers data of the given class.

      This implementation delegates to Transferable.transfer(MediaType).

      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.