Package io.micronaut.core.attr
Interface MutableAttributeHolder
- All Superinterfaces:
AttributeHolder
- All Known Subinterfaces:
ApplicationContext
,BeanContext
,ByteBodyHttpResponse<B>
,ConfigurableApplicationContext
,ConfigurableBeanContext
,ConstructorInvocationContext<T>
,FullHttpRequest<B>
,HttpMessage<B>
,HttpRequest<B>
,HttpResponse<B>
,InitializableBeanContext
,InvocationContext<T,
,R> MethodInvocationContext<T,
,R> MutableHttpMessage<B>
,MutableHttpRequest<B>
,MutableHttpResponse<B>
,PushCapableHttpRequest<B>
,ServerHttpRequest<B>
- All Known Implementing Classes:
AbstractNettyHttpRequest
,ByteBodyHttpResponseWrapper
,ConstructorInterceptorChain
,DefaultApplicationContext
,DefaultBeanContext
,FullNettyClientHttpResponse
,HttpMessageWrapper
,HttpRequestWrapper
,HttpResponseAdapter
,HttpResponseWrapper
,InterceptorChain
,MethodInterceptorChain
,NettyClientHttpRequest
,NettyHttpRequest
,NettyMutableHttpResponse
,SimpleHttpRequest
An interface for types that support mutating attributes.
- Since:
- 1.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescriptionOverrides the defaultAttributeHolder.getAttributes()
method to return a mutable object.removeAttribute
(@NonNull CharSequence name, @NonNull Class<T> type) Remove an attribute.default @NonNull MutableAttributeHolder
setAttribute
(@NonNull CharSequence name, @Nullable Object value) Sets an attribute on the message.Methods inherited from interface io.micronaut.core.attr.AttributeHolder
getAttribute, getAttribute
-
Method Details
-
getAttributes
Overrides the defaultAttributeHolder.getAttributes()
method to return a mutable object.- Specified by:
getAttributes
in interfaceAttributeHolder
- Returns:
- The mutable attributes
-
setAttribute
@NonNull default @NonNull MutableAttributeHolder setAttribute(@NonNull @NonNull CharSequence name, @Nullable @Nullable Object value) Sets an attribute on the message.- Parameters:
name
- The name of the attributevalue
- The value of the attribute- Returns:
- This message
-
removeAttribute
@NonNull default <T> @NonNull Optional<T> removeAttribute(@NonNull @NonNull CharSequence name, @NonNull @NonNull Class<T> type) Remove an attribute. Returning the old value if it is present.- Type Parameters:
T
- type Generic- Parameters:
name
- The name of the attributetype
- The required type- Returns:
- An
Optional
value
-