Top Description Methods
org.springframework.messaging.rsocket

public Interface MetadataExtractorRegistry

Known Direct Implementers
org.springframework.messaging.rsocket.DefaultMetadataExtractor
Imports
java.util.Map, java.util.function.BiConsumer, org.springframework.core.ParameterizedTypeReference, org.springframework.lang.Nullable, org.springframework.util.MimeType

Stores registrations of extractors for metadata entries. Each metadata entry is decoded based on its MimeType and a name is assigned to the decoded value.
Authors
Rossen Stoyanchev, Brian Clozel
Since
5.2
See Also
MetadataExtractor

Method Summary

Modifier and TypeMethod and Description
public default void
metadataToExtract(MimeType
the mime type of metadata entries to extract
mimeType
,
Class<?>
the target value type to decode to
targetType
,
String
assign a name for the decoded value; if not provided, then the mime type is used as the key
name
)

Decode metadata entries with the given MimeType to the specified target class, and store the decoded value in the output map under the given name.

public default void
metadataToExtract(MimeType
the mime type of metadata entries to extract
mimeType
,
ParameterizedTypeReference<?>
the target value type to decode to
targetType
,
String name)

Variant of metadataToExtract(MimeType, Class, String) that accepts ParameterizedTypeReference instead of Class for specifying a target type with generic parameters.

public <
the target value type
T
>
void
metadataToExtract(MimeType
the mime type of metadata entries to extract
mimeType
,
Class<T>
the target value type to decode to
targetType
,
BiConsumer<T, Map<String, Object>>
custom logic to add the decoded value to the output map
mapper
)

Variant of 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.

public <
the target value type
T
>
void
metadataToExtract(MimeType
the mime type of metadata entries to extract
mimeType
,
ParameterizedTypeReference<T>
the target value type to decode to
type
,
BiConsumer<T, Map<String, Object>>
custom logic to add the decoded value to the output map
mapper
)

Variant of metadataToExtract(MimeType, Class, BiConsumer) that accepts ParameterizedTypeReference instead of Class for specifying a target type with generic parameters.

Method Detail

metadataToExtractback to summary
public default void metadataToExtract(MimeType mimeType, Class<?> targetType, String name)

Decode metadata entries with the given MimeType to the specified target class, and store the decoded value in the output map under the given name.

Parameters
mimeType:MimeType

the mime type of metadata entries to extract

targetType:Class<?>

the target value type to decode to

name:String

assign a name for the decoded value; if not provided, then the mime type is used as the key

metadataToExtractback to summary
public default void metadataToExtract(MimeType mimeType, ParameterizedTypeReference<?> targetType, String name)

Variant of metadataToExtract(MimeType, Class, String) that accepts ParameterizedTypeReference instead of Class for specifying a target type with generic parameters.

Parameters
mimeType:MimeType

the mime type of metadata entries to extract

targetType:ParameterizedTypeReference<?>

the target value type to decode to

metadataToExtractback to summary
public <T> void metadataToExtract(MimeType mimeType, Class<T> targetType, BiConsumer<T, Map<String, Object>> mapper)

Variant of 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.

Parameters
<T>
the target value type
mimeType:MimeType

the mime type of metadata entries to extract

targetType:Class<T>

the target value type to decode to

mapper:BiConsumer<T, Map<String, Object>>

custom logic to add the decoded value to the output map

metadataToExtractback to summary
public <T> void metadataToExtract(MimeType mimeType, ParameterizedTypeReference<T> type, BiConsumer<T, Map<String, Object>> mapper)

Variant of metadataToExtract(MimeType, Class, BiConsumer) that accepts ParameterizedTypeReference instead of Class for specifying a target type with generic parameters.

Parameters
<T>
the target value type
mimeType:MimeType

the mime type of metadata entries to extract

type:ParameterizedTypeReference<T>

the target value type to decode to

mapper:BiConsumer<T, Map<String, Object>>

custom logic to add the decoded value to the output map