From f789c9a56ee8713eadff2a06afc1b7937b6205d1 Mon Sep 17 00:00:00 2001 From: Rohan Goyal Date: Wed, 15 Mar 2023 23:06:45 +0530 Subject: [PATCH] Add SanitizableData.withSanitizedValue method See gh-34615 --- .../boot/actuate/endpoint/SanitizableData.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SanitizableData.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SanitizableData.java index a5ca974187..4f0d05b6d7 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SanitizableData.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SanitizableData.java @@ -22,6 +22,7 @@ import org.springframework.core.env.PropertySource; * Value object that represents the data that can be used by a {@link SanitizingFunction}. * * @author Madhura Bhave + * @author Rohan Goyal * @since 2.6.0 **/ public final class SanitizableData { @@ -83,4 +84,12 @@ public final class SanitizableData { return new SanitizableData(this.propertySource, this.key, value); } + /** + * Return a new {@link SanitizableData} instance with sanatized value. + * @return a new sanitizable data instance. + */ + public SanitizableData withSanitizedValue() { + return new SanitizableData(this.propertySource, this.key, SANITIZED_VALUE); + } + }