Class UserDefinedFunctionProvider
Through this class, several User Defined Functions can be made available to Daffodil via a single entry in the META-INF/services file.
UDF Providers must subclass this, and must initialize the userDefinedFunctionClasses array with all the UDF classes it is providing.
If the UDFs being provided have constructors with arguments, the provider subclass must also implement the createUserDefinedFunction to return an initialized function class object based on the supplied namespace and name.
Subclasses must also supply a src/META-INF/services/org.apache.daffodil.api.udf.UserDefinedFunctionProvider file in their JAVA project in order to be discoverable by Daffodil.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateUserDefinedFunction
(String namespaceURI, String fName) Finds and initializes User Defined Function class based on namespace and name provided.abstract Class<?>[]
Must be implemented to return the classes of the User Defined Function this provider is aware of/providing
-
Constructor Details
-
UserDefinedFunctionProvider
public UserDefinedFunctionProvider()
-
-
Method Details
-
getUserDefinedFunctionClasses
Must be implemented to return the classes of the User Defined Function this provider is aware of/providing- Returns:
- array of the different UserDefinedFunction classes it provides
-
createUserDefinedFunction
public UserDefinedFunction createUserDefinedFunction(String namespaceURI, String fName) throws IllegalArgumentException, SecurityException, ExceptionInInitializerError, ReflectiveOperationException Finds and initializes User Defined Function class based on namespace and name provided. The UserDefinedFunctionIdentification annotation applied to the function class must match name and namespaceURI field passed in from the schema.Must be overloaded if the function class's constructor takes arguments. Otherwise it will throw exceptions.
- Parameters:
namespaceURI
- XML namespace associated with schema function callfName
- function name called in schema- Returns:
- initialized UserDefinedFunction object that must contain evaluate function with desired functionality
- Throws:
SecurityException
- if security manager exists and disallows accessIllegalArgumentException
- if the UDF doesn't have a no-argument constructorExceptionInInitializerError
- if there is an issue initializing the UDF objectReflectiveOperationException
- if the UDF doesn't have a no-argument constructor or if there is an issue initializing the UDF object
-