use of net.sf.saxon.value.StringValue in project camel by apache.
the class MyExtensionFunction2 method makeCallExpression.
@Override
public ExtensionFunctionCall makeCallExpression() {
return new ExtensionFunctionCall() {
private static final long serialVersionUID = 1L;
@Override
public Sequence call(XPathContext xPathContext, Sequence[] arguments) throws XPathException {
// 1st argument (mandatory, index 0)
StringValue arg1 = (StringValue) arguments[0].iterate().next();
String arg1Str = arg1.getStringValue();
// 2nd argument (optional, index 1)
String arg2Str = "";
if (arguments.length > 1) {
StringValue arg2 = (StringValue) arguments[1].iterate().next();
arg2Str = arg2.getStringValue();
}
// Functionality goes here
String resultStr = arg1Str + arg2Str;
Item result = new StringValue(resultStr);
return SequenceTool.toLazySequence(SingletonIterator.makeIterator(result));
}
};
}
Aggregations