header relay위한 Concat user function추가
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.transformer.function.generic;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nfunk.jep.ParseException;
|
||||
import org.nfunk.jep.function.PostfixMathCommand;
|
||||
|
||||
public class Concat extends PostfixMathCommand {
|
||||
public Concat() {
|
||||
numberOfParameters = 2;
|
||||
}
|
||||
|
||||
public void run(Stack inStack) throws ParseException {
|
||||
|
||||
checkStack(inStack);
|
||||
|
||||
Object p2 = inStack.pop();
|
||||
|
||||
if (p2 instanceof String) {
|
||||
String str2 = (String) p2;
|
||||
Object p1 = inStack.pop();
|
||||
|
||||
if (p1 instanceof String) {
|
||||
String str1 = (String) p1;
|
||||
|
||||
inStack.push(str1 + str2);
|
||||
|
||||
} else {
|
||||
throw new ParseException("Invalid parameter type, p1 is not string");
|
||||
}
|
||||
} else {
|
||||
throw new ParseException("Invalid parameter type, p2 is not string");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import org.nfunk.jep.function.PostfixMathCommand;
|
||||
|
||||
public class Trim extends PostfixMathCommand {
|
||||
public Trim() {
|
||||
numberOfParameters = 1;
|
||||
numberOfParameters = 2;
|
||||
}
|
||||
|
||||
public void run(Stack inStack) throws ParseException {
|
||||
@@ -16,6 +16,8 @@ public class Trim extends PostfixMathCommand {
|
||||
|
||||
Object p1 = inStack.pop();
|
||||
|
||||
Object p2 = inStack.pop();
|
||||
|
||||
if (p1 instanceof byte[]) {
|
||||
inStack.push(new String((byte[]) p1).trim());
|
||||
} else if (p1 instanceof String) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.eactive.eai.transformer.function.validate;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nfunk.jep.ParseException;
|
||||
import org.nfunk.jep.function.PostfixMathCommand;
|
||||
|
||||
public class isBlank extends PostfixMathCommand {
|
||||
|
||||
public isBlank() {
|
||||
numberOfParameters = 1;
|
||||
}
|
||||
|
||||
public void run(Stack inStack) throws ParseException {
|
||||
|
||||
checkStack(inStack);
|
||||
|
||||
Object p1 = inStack.pop();
|
||||
|
||||
if (p1 instanceof String) {
|
||||
String str1 = (String) p1;
|
||||
|
||||
inStack.push(StringUtils.isBlank(str1));
|
||||
|
||||
} else {
|
||||
throw new ParseException("Invalid parameter type, p1 is not string");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -21,4 +21,5 @@ public class ConcatFunction extends PostfixMathCommand {
|
||||
|
||||
inStack.push(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user