Package io.undertow.util
Class AttachmentKey<T>
- java.lang.Object
-
- io.undertow.util.AttachmentKey<T>
-
- Type Parameters:
T
- the attachment type
public abstract class AttachmentKey<T> extends Object
An immutable, type-safe object attachment key. Such a key has no value outside of its object identity.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
cast(Object value)
Cast the value to the type of this attachment key.static <T> AttachmentKey<T>
create(Class<? super T> valueClass)
Construct a new simple attachment key.static <T> AttachmentKey<AttachmentList<T>>
createList(Class<? super T> valueClass)
Construct a new list attachment key.
-
-
-
Method Detail
-
cast
public abstract T cast(Object value)
Cast the value to the type of this attachment key.- Parameters:
value
- the value- Returns:
- the cast value
-
create
public static <T> AttachmentKey<T> create(Class<? super T> valueClass)
Construct a new simple attachment key.- Type Parameters:
T
- the attachment type- Parameters:
valueClass
- the value class- Returns:
- the new instance
-
createList
public static <T> AttachmentKey<AttachmentList<T>> createList(Class<? super T> valueClass)
Construct a new list attachment key.- Type Parameters:
T
- the list value type- Parameters:
valueClass
- the list value class- Returns:
- the new instance
-
-