[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:
@@ -68,8 +68,8 @@ public class JSonPathTransformationService implements TransformationService {
|
||||
logger.debug("transformation resulted in '{}'", transformationResult);
|
||||
if (transformationResult == null) {
|
||||
return null;
|
||||
} else if (transformationResult instanceof List) {
|
||||
return flattenList((List<?>) transformationResult);
|
||||
} else if (transformationResult instanceof List list) {
|
||||
return flattenList(list);
|
||||
} else {
|
||||
return transformationResult.toString();
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ public class JSonPathTransformationProfile 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);
|
||||
|
||||
Reference in New Issue
Block a user