public abstract class AbstractAttachable extends Object implements Attachable
Constructor and Description |
---|
AbstractAttachable() |
Modifier and Type | Method and Description |
---|---|
<T> void | addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value) Add a value to a list-typed attachment key. |
protected Map<AttachmentKey<?>,Object> | createAttachmentMap() |
<T> T | getAttachment(AttachmentKey<T> key) Get an attachment value. |
<T> List<T> | getAttachmentList(AttachmentKey<? extends List<T>> key) Gets a list attachment value. |
<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 <T> T getAttachment(AttachmentKey<T> key)
null
is returned.getAttachment
in interface Attachable
T
- the value typekey
- the attachment keynull
if there is nonepublic <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key)
getAttachmentList
in interface Attachable
T
- the value typekey
- the attachment keypublic <T> T putAttachment(AttachmentKey<T> key, T value)
null
, the attachment key is removed.putAttachment
in interface Attachable
T
- the value typekey
- the attachment keyvalue
- the new valuenull
if there was noneprotected Map<AttachmentKey<?>,Object> createAttachmentMap()
public <T> T removeAttachment(AttachmentKey<T> key)
removeAttachment
in interface Attachable
T
- the value typekey
- the attachment keynull
if there was nonepublic <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value)
addToAttachmentList
in interface Attachable
T
- the list value typekey
- the attachment keyvalue
- the value to addCopyright © 2017 JBoss by Red Hat. All rights reserved.