Top Description Fields Constructors Methods
io.undertow.util

public abstract Class AbstractAttachable

extends Object
implements Attachable
Class Inheritance
All Implemented Interfaces
io.undertow.util.Attachable
Known Direct Subclasses
io.undertow.client.ClientRequest, io.undertow.client.ClientResponse, io.undertow.client.ajp.AjpClientConnection, io.undertow.client.ajp.AjpClientExchange, io.undertow.client.http.HttpClientConnection, io.undertow.client.http.HttpClientExchange, io.undertow.client.http2.Http2ClientExchange, io.undertow.server.HttpServerExchange, io.undertow.server.ServerConnection
Imports
java.util.Collections, .IdentityHashMap, .List, .Map, io.undertow.UndertowMessages

A thing which can have named attachments.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private Map<AttachmentKey<?>, Object>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <T> void
addToAttachmentList(final AttachmentKey<AttachmentList<T>>
the attachment key
key
,
final T
the value to add
value
)

Implements io.undertow.util.Attachable.addToAttachmentList.

Add a value to a list-typed attachment key.

protected Map<AttachmentKey<?>, Object>
public <T> T
getAttachment(final AttachmentKey<T>
the attachment key
key
)

Implements io.undertow.util.Attachable.getAttachment.

Get an attachment value.

public <T> List<T>
getAttachmentList(AttachmentKey<? extends List<T>>
the attachment key
key
)

Implements io.undertow.util.Attachable.getAttachmentList.

Gets a list attachment value.

public <T> T
putAttachment(final AttachmentKey<T>
the attachment key
key
,
final T
the new value
value
)

Implements io.undertow.util.Attachable.putAttachment.

Set an attachment value.

public <T> T
removeAttachment(final AttachmentKey<T>
the attachment key
key
)

Implements io.undertow.util.Attachable.removeAttachment.

Remove an attachment, returning its previous value.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attachmentsback to summary
private Map<AttachmentKey<?>, Object> attachments

Constructor Detail

AbstractAttachableback to summary
public AbstractAttachable()

Method Detail

addToAttachmentListback to summary
public <T> void addToAttachmentList(final AttachmentKey<AttachmentList<T>> key, final T value)

Implements io.undertow.util.Attachable.addToAttachmentList.

Doc from io.undertow.util.Attachable.addToAttachmentList.

Add a value to a list-typed attachment key. If the key is not mapped, add such a mapping.

Parameters
<T>
the list value type
key:AttachmentKey<AttachmentList<T>>

the attachment key

value:T

the value to add

Annotations
@Override
createAttachmentMapback to summary
protected Map<AttachmentKey<?>, Object> createAttachmentMap()
getAttachmentback to summary
public <T> T getAttachment(final AttachmentKey<T> key)

Implements io.undertow.util.Attachable.getAttachment.

Doc from io.undertow.util.Attachable.getAttachment.

Get an attachment value. If no attachment exists for this key, null is returned.

Parameters
<T>
the value type
key:AttachmentKey<T>

the attachment key

Returns:T

the value, or null if there is none

Annotations
@Override
getAttachmentListback to summary
public <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key)

Implements io.undertow.util.Attachable.getAttachmentList.

Doc from io.undertow.util.Attachable.getAttachmentList.

Gets a list attachment value. If not attachment exists for this key an empty list is returned

Parameters
<T>
the value type
key:AttachmentKey<? extends List<T>>

the attachment key

Returns:List<T>

the value, or an empty list if there is none

Annotations
@Override
putAttachmentback to summary
public <T> T putAttachment(final AttachmentKey<T> key, final T value)

Implements io.undertow.util.Attachable.putAttachment.

Doc from io.undertow.util.Attachable.putAttachment.

Set an attachment value. If an attachment for this key was already set, return the original value. If the value being set is null, the attachment key is removed.

Parameters
<T>
the value type
key:AttachmentKey<T>

the attachment key

value:T

the new value

Returns:T

the old value, or null if there was none

Annotations
@Override
removeAttachmentback to summary
public <T> T removeAttachment(final AttachmentKey<T> key)

Implements io.undertow.util.Attachable.removeAttachment.

Doc from io.undertow.util.Attachable.removeAttachment.

Remove an attachment, returning its previous value.

Parameters
<T>
the value type
key:AttachmentKey<T>

the attachment key

Returns:T

the old value, or null if there was none

Annotations
@Override