[transform] Code optimization for Java17: instanceof matching and multiline strings (#15483)

Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
Holger Friedrich
2023-08-24 06:41:36 +02:00
committed by GitHub
parent db651f9e92
commit 6e49c6e6ec
13 changed files with 111 additions and 107 deletions

View File

@@ -64,9 +64,9 @@ public class MapTransformationProfile implements StateProfile {
if (paramSource == null) {
paramSource = "%s";
}
if (paramFunction instanceof String && paramSource instanceof String) {
function = (String) paramFunction;
sourceFormat = (String) paramSource;
if (paramFunction instanceof String pFunction && paramSource instanceof String pFormat) {
function = pFunction;
sourceFormat = pFormat;
} else {
logger.error("Parameter '{}' and '{}' have to be Strings. Profile will be inactive.", FUNCTION_PARAM,
SOURCE_FORMAT_PARAM);