stevedlawrence commented on a change in pull request #273: WIP: Add User Defined Functions Capability URL: https://github.com/apache/incubator-daffodil/pull/273#discussion_r331203430
########## 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": Review comment: Yeah, something like that seems like a good practice. Note that we can't enforce it because in Java you can't have static interfaces and require the user to implement static functions. But as a practice that would be a good idea. Does it make sense to require a namespace/name static member via reflection, like we require an evaluate function to exist? That would sort of force good conventions. But that duplicates the FunctionClassInfo annotation. Does it make sense to replace the FunctionClassInfo with satic members? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services