mgaido91 commented on a change in pull request #3615: NIFI-6500 Support Padding
functions in Expression Language
URL: https://github.com/apache/nifi/pull/3615#discussion_r309385222
##########
File path:
nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/compile/ExpressionCompiler.java
##########
@@ -652,6 +656,28 @@ private DateEvaluator toDateEvaluator(final Evaluator<?>
evaluator, final String
toStringEvaluator(argEvaluators.get(0), "first argument to
replaceAll"),
toStringEvaluator(argEvaluators.get(1), "second argument
to replaceAll")), "replaceAll");
}
+ case PAD_LEFT: {
+ if (argEvaluators.size() == 1) {
+ return addToken(new
PadLeftEvaluator(toStringEvaluator(subjectEvaluator),
+ toWholeNumberEvaluator(argEvaluators.get(0),
"desired string length")),
+ "padLeft");
+ } else {
+ return addToken(new
PadLeftEvaluator(toStringEvaluator(subjectEvaluator),
+ toWholeNumberEvaluator(argEvaluators.get(0),
"desired string length"),
+ toStringEvaluator(argEvaluators.get(1), "padding
character")), "padLeft");
+ }
+ }
+ case PAD_RIGHT: {
+ if (argEvaluators.size() == 1) {
+ return addToken(new
PadRightEvaluator(toStringEvaluator(subjectEvaluator),
+
toWholeNumberEvaluator(argEvaluators.get(0), "desired string length")),
+ "padRight");
Review comment:
indent
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services