ConcatN 가변 파라미터 문자열 연결 함수 추가 및 단위테스트 작성

- ConcatN: numberOfParameters=-1로 파라미터 수 제한 없이 문자열 연결
- 기존 Concat(2개 고정)을 대체 가능하며 하위 호환성 유지
- ConcatNFunctionTest: JEP 직접 사용, 파라미터 수 변화 검증
- ConcatNParserTest: Parser 클래스 경유, 변수/상수 혼합 표현식 및 성능 검증

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curry772
2026-05-08 13:25:37 +09:00
parent 17f6df5068
commit 2d3f659012
3 changed files with 354 additions and 0 deletions
@@ -0,0 +1,38 @@
package com.eactive.eai.transformer.function.generic;
import java.util.Stack;
import org.nfunk.jep.ParseException;
import org.nfunk.jep.function.PostfixMathCommand;
public class ConcatN extends PostfixMathCommand {
public ConcatN() {
numberOfParameters = -1;
}
@SuppressWarnings("unchecked")
public void run(Stack inStack) throws ParseException {
checkStack(inStack);
int n = curNumberOfParameters;
if (n < 1) {
throw new ParseException("concatN() requires at least 1 parameter");
}
String[] params = new String[n];
for (int i = n - 1; i >= 0; i--) {
Object p = inStack.pop();
if (!(p instanceof String)) {
throw new ParseException("Invalid parameter type: parameter " + (i + 1) + " is not a string");
}
params[i] = (String) p;
}
StringBuilder sb = new StringBuilder();
for (String s : params) {
sb.append(s);
}
inStack.push(sb.toString());
}
}