Add SanitizableData.withSanitizedValue method

See gh-34615
This commit is contained in:
Rohan Goyal
2023-03-15 23:06:45 +05:30
committed by Phillip Webb
parent 7f5dc1cde5
commit f789c9a56e

View File

@@ -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);
}
}