T
- The type of attachment.public final class Attachment<T> extends Object
AttachmentHolder
instances. Storing attachment values in AttachmentHolder
has the
advantage of the Attachment value being typed when compared to Map
storage:Constructor and Description |
---|
Attachment(String name,
T defaultValue)
Construct a new attachment with the specified name and default value.
|
Modifier and Type | Method and Description |
---|---|
T |
get(AttachmentHolder attachmentHolder)
Retrieves the attachment value, stored on the
AttachmentHolder . |
T |
remove(AttachmentHolder attachmentHolder)
Remove attachment value, stored on the
AttachmentHolder . |
T |
set(AttachmentHolder attachmentHolder,
T value)
Set attachment value, stored on the
AttachmentHolder . |
public Attachment(String name, T defaultValue)
name
- Attachment name.defaultValue
- Attachment default value, which will be used, if it is not
set.public T get(AttachmentHolder attachmentHolder)
AttachmentHolder
.attachmentHolder
- AttachmentHolder
.public T remove(AttachmentHolder attachmentHolder)
AttachmentHolder
.attachmentHolder
- AttachmentHolder
.null
if there was previously no
value.public T set(AttachmentHolder attachmentHolder, T value)
AttachmentHolder
. If a value
already exists, it will be replaced.attachmentHolder
- AttachmentHolder
.value
- attachment value to set.null
if there was previously no
value.Copyright 2010-2017 ForgeRock AS.