类 DefaultMetadataExtractor
- java.lang.Object
- org.springframework.messaging.rsocket.DefaultMetadataExtractor
- 所有已实现的接口:
MetadataExtractor
,MetadataExtractorRegistry
public class DefaultMetadataExtractor extends Object implements MetadataExtractor, MetadataExtractorRegistry
DefaultMetadataExtractor
implementation that relies onDecoder
s to deserialize the content of metadata entries.By default only
"message/x.rsocket.routing.v0""
is extracted and saved underMetadataExtractor.ROUTE_KEY
. UsemetadataToExtract
methods to specify other metadata mime types of interest to extract.- 从以下版本开始:
- 5.2
- 作者:
- Rossen Stoyanchev
字段概要
从接口继承的字段 org.springframework.messaging.rsocket.MetadataExtractor
ROUTE_KEY
构造器概要
构造器 构造器 说明 DefaultMetadataExtractor(List<Decoder<?>> decoders)
Constructor with list of decoders for de-serializing metadata entries.DefaultMetadataExtractor(Decoder<?>... decoders)
Constructor with decoders for de-serializing metadata entries.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Map<String,Object>
extract(io.rsocket.Payload payload, MimeType metadataMimeType)
Extract a map of values from the givenPayload
metadata.List<? extends Decoder<?>>
getDecoders()
Return a read-only list with the configured decoders.<T> void
metadataToExtract(MimeType mimeType, Class<T> targetType, BiConsumer<T,Map<String,Object>> mapper)
Variant ofMetadataExtractorRegistry.metadataToExtract(MimeType, Class, String)
that allows custom logic to be used to map the decoded value to any number of values in the output map.<T> void
metadataToExtract(MimeType mimeType, ParameterizedTypeReference<T> type, BiConsumer<T,Map<String,Object>> mapper)
Variant ofMetadataExtractorRegistry.metadataToExtract(MimeType, Class, BiConsumer)
that acceptsParameterizedTypeReference
instead ofClass
for specifying a target type with generic parameters.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.messaging.rsocket.MetadataExtractorRegistry
metadataToExtract, metadataToExtract
构造器详细资料
DefaultMetadataExtractor
public DefaultMetadataExtractor(Decoder<?>... decoders)
Constructor with decoders for de-serializing metadata entries.
DefaultMetadataExtractor
public DefaultMetadataExtractor(List<Decoder<?>> decoders)
Constructor with list of decoders for de-serializing metadata entries.
方法详细资料
getDecoders
public List<? extends Decoder<?>> getDecoders()
Return a read-only list with the configured decoders.
metadataToExtract
public <T> void metadataToExtract(MimeType mimeType, Class<T> targetType, BiConsumer<T,Map<String,Object>> mapper)
从接口复制的说明:MetadataExtractorRegistry
Variant ofMetadataExtractorRegistry.metadataToExtract(MimeType, Class, String)
that allows custom logic to be used to map the decoded value to any number of values in the output map.- 指定者:
metadataToExtract
在接口中MetadataExtractorRegistry
- 类型参数:
T
- the target value type- 参数:
mimeType
- the mime type of metadata entries to extracttargetType
- the target value type to decode tomapper
- custom logic to add the decoded value to the output map
metadataToExtract
public <T> void metadataToExtract(MimeType mimeType, ParameterizedTypeReference<T> type, BiConsumer<T,Map<String,Object>> mapper)
从接口复制的说明:MetadataExtractorRegistry
Variant ofMetadataExtractorRegistry.metadataToExtract(MimeType, Class, BiConsumer)
that acceptsParameterizedTypeReference
instead ofClass
for specifying a target type with generic parameters.- 指定者:
metadataToExtract
在接口中MetadataExtractorRegistry
- 类型参数:
T
- the target value type- 参数:
mimeType
- the mime type of metadata entries to extracttype
- the target value type to decode tomapper
- custom logic to add the decoded value to the output map
extract
public Map<String,Object> extract(io.rsocket.Payload payload, MimeType metadataMimeType)
从接口复制的说明:MetadataExtractor
Extract a map of values from the givenPayload
metadata. The Payload "route", if present, should be saved underMetadataExtractor.ROUTE_KEY
.- 指定者:
extract
在接口中MetadataExtractor
- 参数:
payload
- the payload whose metadata should be readmetadataMimeType
- the metadata MimeType for the connection.- 返回:
- name values pairs extracted from the metadata