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 java.lang.Object implements Transferable<S>
An abstract object that can be transferred, such as between components using drag and drop.- Author:
- Garret Wilson
-
-
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
-
Methods inherited from interface io.guise.framework.component.transfer.Transferable
getContentTypes, transfer
-
-
-
-
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 isnull
.
-
-
Method Detail
-
getSource
public S getSource()
- Specified by:
getSource
in interfaceTransferable<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 interfaceTransferable<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 interfaceTransferable<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
.
-
-