public abstract class Attachable extends Object
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getAttachment(AttachmentKey<T> key)
Get an attachment from this object.
|
Map |
getAttachments()
Returns the attachments applicable for this
Attachable. |
<T> T |
putAttachment(AttachmentKey<T> key,
T value)
Set an attachment on this object.
|
<T> T |
putAttachmentIfAbsent(AttachmentKey<T> key,
T value)
Set an attachment on this object if an existing attachment does not already exist.
|
<T> T |
removeAttachment(AttachmentKey<T> key)
Remove and return an attachment value.
|
<T> boolean |
removeAttachment(AttachmentKey<T> key,
T value)
Remove an attachment if it has a certain value.
|
<T> T |
replaceAttachment(AttachmentKey<T> key,
T value)
Replace an attachment on this object if an existing attachment exists.
|
<T> boolean |
replaceAttachment(AttachmentKey<T> key,
T oldValue,
T newValue)
Replace an attachment on this object if an existing attachment exists with a certain value.
|
public <T> T getAttachment(AttachmentKey<T> key)
T - the attachment typekey - the attachment keypublic Map getAttachments()
Attachable. The returned Map
is an unmodifiable Map. If there are no attachments for this Attachable
then this method returns an empty Mappublic <T> T putAttachment(AttachmentKey<T> key, T value)
T - the attachment typekey - the attachment keyvalue - the attachment's new value (may not be null)null if there was nonepublic <T> T putAttachmentIfAbsent(AttachmentKey<T> key, T value)
T - the attachment typekey - the attachment keyvalue - the attachment's new value (may not be null)null if there was nonepublic <T> T replaceAttachment(AttachmentKey<T> key, T value)
T - the attachment typekey - the attachment keyvalue - the attachment's new value (may not be null)null if there was nonepublic <T> boolean replaceAttachment(AttachmentKey<T> key, T oldValue, T newValue)
T - the attachment typekey - the attachment keyoldValue - the attachment's expected value (may not be null)newValue - the attachment's new value (may not be null)true if the old value matched and the value was replaced; false otherwisepublic <T> T removeAttachment(AttachmentKey<T> key)
T - the attachment typekey - the attachment keynull if there was nonepublic <T> boolean removeAttachment(AttachmentKey<T> key, T value)
T - the attachment typekey - the attachment keyvalue - the attachment's expected value (may not be null)true if the value was removed, false if there was no attachmentCopyright © 2018 JBoss by Red Hat. All rights reserved.