Class JsonPulsarHeaderMapper.JsonPulsarHeaderMapperBuilder
java.lang.Object
org.springframework.pulsar.support.header.JsonPulsarHeaderMapper.JsonPulsarHeaderMapperBuilder
- Enclosing class:
JsonPulsarHeaderMapper
- Author:
- Chris Bono
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()inboundPatterns(String... patterns) Adds to the list of patterns to be used for inbound header matching.objectMapper(@Nullable com.fasterxml.jackson.databind.ObjectMapper objectMapper) Sets the object mapper to use to read/write header values as JSON.outboundPatterns(String... patterns) Adds to the list of patterns to be used for outbound header matching.toStringClasses(String... classNames) Add class names to the list of classes that should be serialized using theirObject.toString()method.trustedPackages(String... packages) Add packages to the trusted list used when deserializing JSON header values.
-
Constructor Details
-
JsonPulsarHeaderMapperBuilder
public JsonPulsarHeaderMapperBuilder()
-
-
Method Details
-
objectMapper
public JsonPulsarHeaderMapper.JsonPulsarHeaderMapperBuilder objectMapper(@Nullable com.fasterxml.jackson.databind.ObjectMapper objectMapper) Sets the object mapper to use to read/write header values as JSON.- Parameters:
objectMapper- the object mapper- Returns:
- current builder
-
trustedPackages
Add packages to the trusted list used when deserializing JSON header values. Trust is by exact package match; a class is trusted only if its declaring package appears in this list. Sub-packages are not trusted transitively — add them explicitly if needed.The specified packages are added to
JsonPulsarHeaderMapper.DEFAULT_TRUSTED_PACKAGES, which are always included. Pass"*"as the sole entry to trust all packages instead (not recommended when consuming from untrusted sources).If a class for a non-trusted package is encountered, the header is returned to the application with value of type
JsonPulsarHeaderMapper.NonTrustedHeaderType.- Parameters:
packages- the packages to add to the trusted list - if any entry is"*"all packages are trusted and the defaults are ignored- Returns:
- current builder
-
toStringClasses
Add class names to the list of classes that should be serialized using theirObject.toString()method.- Parameters:
classNames- the class names to add to the 'toString' list- Returns:
- current builder
-
inboundPatterns
Adds to the list of patterns to be used for inbound header matching.- Parameters:
patterns- inbound patterns to add- Returns:
- current builder
-
outboundPatterns
Adds to the list of patterns to be used for outbound header matching.- Parameters:
patterns- outbound patterns to add- Returns:
- current builder
-
build
-