java.lang.Object
com.darkcollective.relix.function.builtin.BuiltinFunctionLibrary
All Implemented Interfaces:
FunctionLibrary

public final class BuiltinFunctionLibrary extends Object implements FunctionLibrary
The functions relix ships with: the scalars — string, numeric, temporal, conditional, type-check, conversion and nested-data — and the eight aggregates.

It is an ordinary FunctionLibrary, discovered the same way any other is and built out of the same published seam. Nothing about it is privileged: a library that declares a higher priority replaces any function here by name, and one that declares a lower priority fills gaps around it.

This class exists to be found by ServiceLoader, so it has a public no-argument constructor and is declared as a provider in both of the two places discovery looks.

  • Field Details

    • NAME

      public static final String NAME
      The name this library reports, including in a message about a name clash.
      See Also:
  • Constructor Details

    • BuiltinFunctionLibrary

      public BuiltinFunctionLibrary()
      Creates the library. Discovery calls this; there is nothing to configure.
  • Method Details

    • name

      public String name()
      Description copied from interface: FunctionLibrary
      A short identifier for this library, used in diagnostics — including the one that reports two libraries offering the same function name.
      Specified by:
      name in interface FunctionLibrary
      Returns:
      the library's name; never null or blank
    • scalarFunctions

      public List<ScalarFunction> scalarFunctions()
      Description copied from interface: FunctionLibrary
      The scalar functions this library offers.
      Specified by:
      scalarFunctions in interface FunctionLibrary
      Returns:
      the scalar functions; empty by default
    • aggregateFunctions

      public List<AggregateFunction> aggregateFunctions()
      Description copied from interface: FunctionLibrary
      The aggregates this library offers.
      Specified by:
      aggregateFunctions in interface FunctionLibrary
      Returns:
      the aggregates; empty by default
    • documentation

      public Optional<String> documentation(String docKey)
      The reference page for one of this library's functions, read from the library's own resources.

      The pages are the repository's docs/reference/functions tree, copied in at build time rather than moved: they are still read from the source tree by the PDF build and the training-corpus extractor, and a page has one home.

      Specified by:
      documentation in interface FunctionLibrary
      Parameters:
      docKey - the documentation key of one of this library's functions
      Returns:
      the Markdown page, or empty when this library has no page under that key