public class SimpleAttachable extends Object implements Attachable
Attachable which may be used as a base class or on a standalone basis.
This class is thread safe, as all methods are synchronized.
| Constructor and Description |
|---|
SimpleAttachable() |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addToAttachmentList(AttachmentKey<AttachmentList<T>> key,
T value)
Add a value to a list-typed attachment key.
|
Set<AttachmentKey<?>> |
attachmentKeys() |
<T> T |
getAttachment(AttachmentKey<T> key)
Get an attachment value.
|
<T> List<T> |
getAttachmentList(AttachmentKey<? extends List<T>> key)
Gets a list attachment value.
|
boolean |
hasAttachment(AttachmentKey<?> key)
Check if an attachment exists for this key.
|
<T> T |
putAttachment(AttachmentKey<T> key,
T value)
Set an attachment value.
|
<T> T |
removeAttachment(AttachmentKey<T> key)
Remove an attachment, returning its previous value.
|
public boolean hasAttachment(AttachmentKey<?> key)
hasAttachment in interface Attachablekey - the attachment keyfalse if there is nonepublic <T> T getAttachment(AttachmentKey<T> key)
null is returned.getAttachment in interface AttachableT - the value typekey - the attachment keynull if there is nonepublic <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key)
getAttachmentList in interface AttachableT - the value typekey - the attachment keypublic <T> T putAttachment(AttachmentKey<T> key, T value)
null, the attachment key is removed.putAttachment in interface AttachableT - the value typekey - the attachment keyvalue - the new valuenull if there was nonepublic <T> T removeAttachment(AttachmentKey<T> key)
removeAttachment in interface AttachableT - the value typekey - the attachment keynull if there was nonepublic <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value)
addToAttachmentList in interface AttachableT - the list value typekey - the attachment keyvalue - the value to addpublic Set<AttachmentKey<?>> attachmentKeys()
Copyright © 2020 JBoss by Red Hat. All rights reserved.