Describe Function with FunctionName - STEMLab/geotools GitHub Wiki

Description

The gt-opengis interfaces provide the concept of *FunctionName*. We currently make FunctionName available through the FunctionFactory interface; this offers a the name of the function, the number of arguments, and the names of each argument that can be presented to the user.

Our default implementation, DefaultFunctionFinder, using FactorySPI reflection against Function implementation is is only able to fake this information.

I would like to make this information available by adding:

  • Function.getFunctionName()
  • FunctionFinder.getFunctionNames()
  • FilterFactory.functionName(name, nargs, argNames)

See tasks for a description of the current patch.

The optional part of this proposal has been carved off as a separate undertaking: FilterFactory cleanup

Status

This proposal needs some discussion; but it already has a patch on the attached JIRA.

Voting has not started yet:

------------|--------------------|------------|-------------------------|-------------------------------| no progress | done | impeded | lack mandate/funds/time | volunteer needed |

  1. ✅ Add Filter.getFunctionName()
  2. ✅ Update the base classes (so existing implementations will work)
  3. ✅ Update the unique implementations (making use of static NAME field where provided)
  4. ✅ Remove deprecated CommonFactoryFinder.getFunctionExpression() as it has not been used or useful for ages
  5. ✅ Update DefaultFunctionFactory to use Name information (yay!)
  6. ✅ Addition of FilterFactory.functionName(String name, int nargs, List<String> argNames) (preexisting mistake)
  7. ✅ No sample code is effected by this change
  8. Update the user guide diagram and text for Function

Function API Change

BEFORE

public interface Function extends Expression {
    String getName();
    List<Expression> getParameters();
    Literal getFallbackValue();
}
interface FilterFactory {
    ....
    /** function name */
    FunctionName functionName(String name, int nargs);
    ...
}
class FunctionFinder {
   ..
}

AFTER

public interface Function extends Expression {
    String getName();
    FunctionName getFunctionName();
    List<Expression> getParameters();
    Literal getFallbackValue();
}
interface FilterFactory {
    ....
    /** function name */
    FunctionName functionName(String name, int nargs);
    FunctionName functionName(String name, int nargs, List<String> argNames);
    ...
}
class FunctionFinder {
   List<FunctionName> getAllFunctionDescriptions()
   FunctionName findFunctionDescription(String)
   ..
}

Documentation Changes

⚠️ **GitHub.com Fallback** ⚠️