olabusayoT commented on a change in pull request #273: WIP: Add User Defined
Functions Capability
URL: https://github.com/apache/incubator-daffodil/pull/273#discussion_r334018600
##########
File path:
daffodil-test/src/test/java/org/goodudfs/example/StringFunctions/StringFunctionsProvider.java
##########
@@ -0,0 +1,25 @@
+package org.goodudfs.example.StringFunctions;
+
+import org.apache.daffodil.udf.*;
+
+public class StringFunctionsProvider extends UDFunctionProvider {
+ public StringFunctionsProvider() {
+ super.setFunctionClasses( new Class<?>[] { Replace.class,
Compare.class } );
+ }
+
+ public Object lookupFunctionClass(String namespace, String name) {
+ Object functionClass = null;
+
+ String nn = String.join("_", namespace, name);
+
+ switch (nn) {
+ case "com.ext.UDFunction.StringFunctions_replace":
+ functionClass = new Replace();
+ break;
+ case "com.ext.UDFunction.StringFunctions_compare":
+ functionClass = new Compare();
+ break;
+ }
+ return functionClass;
Review comment:
Ahh yes, this was definitely misnamed and has been updated to actually do
the function class and evaluate method checks. We now return the
functionClassObject, evaluateMethod, paramTypes and retType. So it's called
lookupUDFCallingInfo. Any naming suggestions welcome!
----------------------------------------------------------------
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