public abstract class Attachment extends java.lang.Object implements IAttachment
Base for IAttachment implementations.
Constructor and Description |
---|
Attachment() |
Modifier and Type | Method and Description |
---|---|
void |
attach(INode owner)
Adds this instance to the supplied node.
|
void |
detach(INode owner)
Removes this instance from the supplied node.
|
INode |
getOwner()
Returns the node this attachment is attached to or null if there is no
attached node.
|
boolean |
isSingleton()
If the attachment is a singleton, only a single instance of the
attachment can be attached to any given node.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getType
public INode getOwner()
IAttachment
Returns the node this attachment is attached to or null if there is no attached node.
getOwner
in interface IAttachment
IAttachment.getOwner()
public void attach(INode owner)
IAttachment
Adds this instance to the supplied node. The attachment's functionality will be applied to the new owner node.
If the attachment is a singleton, this will replace any existing attachment of the same type.
attach
in interface IAttachment
owner
- the node to attach toIAttachment.attach(INode)
public void detach(INode owner)
IAttachment
Removes this instance from the supplied node. Any functionality provided by this attachment will be removed from the owner node.
If the supplied node is not attached, this is a no-op.
detach
in interface IAttachment
owner
- the node to detach fromIAttachment.detach(INode)
public boolean isSingleton()
IAttachment
If the attachment is a singleton, only a single instance of the attachment can be attached to any given node.
isSingleton
in interface IAttachment
IAttachment.isSingleton()