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
An abstract object that can be transferred, such as between components using drag and drop.
- Author:
- Garret Wilson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canTransfer
(com.globalmentor.net.MediaType contentType) Determines whether this transferable can transfer data with the given content type.<T> T
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 Details
-
AbstractTransferable
Source constructor.- Parameters:
source
- The source of the transferable data.- Throws:
NullPointerException
- if the provided source isnull
.
-
-
Method Details
-
getSource
- Specified by:
getSource
in interfaceTransferable<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 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
Transfers data of the given class.This implementation delegates to
Transferable.transfer(MediaType)
.- 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
.
-