Package org.eclipse.jetty.util
Interface Attributes
- All Known Subinterfaces:
ConnectionMetaData
,Context
,Environment
,Request
,Request.ServeAs
,ServerUpgradeRequest
,ServerUpgradeRequest
,Session
- All Known Implementing Classes:
AbstractMetaDataConnection
,AttributeContainerMap
,Attributes.Layer
,Attributes.Lazy
,Attributes.Mapped
,Attributes.Synthetic
,Attributes.Wrapper
,AttributesMap
,ConnectionMetaData.Wrapper
,ContextHandler
,ContextHandler.ScopedContext
,ContextRequest
,Environment.Named
,ErrorHandler.ErrorRequest
,GzipRequest
,HeaderWrappingRequest
,HTTP2ServerConnection
,HttpChannelState.ChannelRequest
,HttpConnection
,HttpConversation
,HttpSpiContextHandler
,ManagedSession
,MovedContextHandler
,Request.AttributesWrapper
,Request.Wrapper
,ResourceHandler.ResourceContext
,Rule.Handler
,Rule.HttpURIHandler
,SecureRequestCustomizer.SecureRequest
,SecureRequestCustomizer.SecureRequestWithSslSessionData
,Server
,ServerFCGIConnection
,ServerUpgradeRequestDelegate
,ServerUpgradeRequestImpl
,ServletContextHandler
,ServletContextHandler.ServletScopedContext
,ServletContextRequest
,ServletCoreRequest
,ServletCoreRequest.ServletAttributes
,StatisticsHandler.MinimumDataRateHandler.MinimumDataRateRequest
,WebAppContext
public interface Attributes
Attributes.
Interface commonly used for storing attributes.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
AnAttributes
implementation backed by anotherAttributes
instance, which is treated as immutable, but with a ConcurrentHashMap used as a mutable layer over it.static class
AnAttributes
implementation that lazily creates a backing map iff it is actually needed.static class
An Attributes implementation backed by aConcurrentHashMap
.static class
An abstract implementation ofAttributes.Wrapper
that provides a mechanism for synthetic attributes that can be modified or deleted.static class
A Wrapper of attributes -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Clear all attribute namesboolean
static boolean
equals
(Attributes attributes, Object o) getAttribute
(String name) Get an attributeGet the immutable set of attribute names.int
hashCode()
static int
hashCode
(Attributes attributes) removeAttribute
(String name) Remove an attributesetAttribute
(String name, Object attribute) Set an attributestatic Attributes
unwrap
(Attributes attributes) Unwrap allAttributes.Wrapper
s of the attributesstatic <T extends Attributes.Wrapper>
Tunwrap
(Attributes attributes, Class<T> target) Unwrap attributes to a specific attributeAttributes.Wrapper
.
-
Field Details
-
NULL
-
-
Method Details
-
removeAttribute
Remove an attribute- Parameters:
name
- the attribute to remove- Returns:
- the value of the attribute if removed, else
null
-
setAttribute
Set an attribute- Parameters:
name
- the attribute to setattribute
- the value to set. A null value is equivalent to removing the attribute.- Returns:
- the previous value of the attribute if set, else
null
-
getAttribute
Get an attribute- Parameters:
name
- the attribute to get- Returns:
- the value of the attribute, or
null
if no such attribute exists
-
getAttributeNameSet
Get the immutable set of attribute names.- Returns:
- Set of attribute names, or an empty set if there are no attributes.
-
asAttributeMap
-
clearAttributes
default void clearAttributes()Clear all attribute names -
hashCode
int hashCode() -
equals
-
unwrap
Unwrap allAttributes.Wrapper
s of the attributes- Parameters:
attributes
- The attributes to unwrap, which may be aAttributes.Wrapper
.- Returns:
- The core attributes
-
hashCode
-
equals
-
unwrap
Unwrap attributes to a specific attributeAttributes.Wrapper
.- Type Parameters:
T
- The type of the targetAttributes.Wrapper
.- Parameters:
attributes
- The attributes to unwrap, which may be aAttributes.Wrapper
target
- The targetAttributes.Wrapper
class.- Returns:
- The outermost
Attributes.Wrapper
of the matching type of null if not found.
-