Package org.forgerock.opendj.server.core
Class Attachment<T>
- java.lang.Object
-
- org.forgerock.opendj.server.core.Attachment<T>
-
- Type Parameters:
T- The type of attachment.
public final class Attachment<T> extends Object
Class used to define dynamic typed attachments onAttachmentHolderinstances. Storing attachment values inAttachmentHolderhas the advantage of the Attachment value being typed when compared to Map storage:
-
-
Constructor Summary
Constructors Constructor Description Attachment(String name, T defaultValue)Construct a new attachment with the specified name and default value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tget(AttachmentHolder attachmentHolder)Retrieves the attachment value, stored on theAttachmentHolder.Tremove(AttachmentHolder attachmentHolder)Remove attachment value, stored on theAttachmentHolder.Tset(AttachmentHolder attachmentHolder, T value)Set attachment value, stored on theAttachmentHolder.
-
-
-
Method Detail
-
get
public T get(AttachmentHolder attachmentHolder)
Retrieves the attachment value, stored on theAttachmentHolder.- Parameters:
attachmentHolder-AttachmentHolder.- Returns:
- attachment value.
-
remove
public T remove(AttachmentHolder attachmentHolder)
Remove attachment value, stored on theAttachmentHolder.- Parameters:
attachmentHolder-AttachmentHolder.- Returns:
- The former value or
nullif there was previously no value.
-
set
public T set(AttachmentHolder attachmentHolder, T value)
Set attachment value, stored on theAttachmentHolder. If a value already exists, it will be replaced.- Parameters:
attachmentHolder-AttachmentHolder.value- attachment value to set.- Returns:
- The former value or
nullif there was previously no value.
-
-