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_r331548355
########## 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: Ah, state is a good reason to have the the lookup function. I'm not against a rename if it makes things more clear. I guess the problem with a UDF abstract class with name/namespace, now that I think about it, is that we would need to create an instance of the UDF to be able to get the information, which we don't want to do. So it must be eiher an annotation of static members. I guess they are basically the same reflection so I'm not sure it matters that much. Maybe the advantage of annotations is those are compile time checked to ensure the right attributes are provided (I assume?). Whereas we can't enforce that static members exist at compile time. ---------------------------------------------------------------- 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