...
Code Block |
---|
|
case class UDFunctionCallExpr(nameAsParsed: String, fnQName: RefQName, args: List[Expression],
resultType: NodeInfo.Kind, argsTypes: List[NodeInfo.Kind], constructor: List[CompiledDPath] => RecipeOp)
extends FunctionCallBase(nameAsParsed, fnQName, args) {
lazy val argsToArgType = (args zip argsTypes).toMap
override lazy val inherentType = resultType
override def targetTypeForSubexpression(childExpr: Expression): NodeInfo.Kind = {
argsToArgType.get(childExpr) match {
case Some(argType) => argType
case None => {
Assert.invariantFailed("subexpression %s is not an argument.".format(subexp))
}
}
}
override lazy val compiledDPath = {
val recipes = args.map { _.compiledDPath }
val res = new CompiledDPath(constructor(recipes) +: conversions)
res
}
}
case class UDFunctionCall(recipes: List[CompiledDPath], functionClassObject: Object, udfEvaluate: Method)
extends FNArgsList(recipes) {
override def computeValues(values: List[Any], dstate: DState) = {
val res = udfEvaluate.invoke(functionClassObject, values: _*) //might need to explicitly cast values to type Object before hand
res
}
} |
Prototype
UDFunctionProviderImpl.jar needs UDFunctionProvider.jar
MockDaffodil.jar needs UDFunctionProviderImpl.jar & UDFunctionProvider.jar
MockDaffodil is a Scala app, that also contains a JAVA class that uses ServiceLoader
View file |
---|
name | UDFunctionProvider.jar |
---|
height | 250 |
---|
|
View file |
---|
name | UDFunctionProviderImpl.jar |
---|
height | 250 |
---|
|
View file |
---|
name | MockDaffodil.jar |
---|
height | 250 |
---|
|