Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom function registration in Java API #101

Merged
merged 1 commit into from
Nov 3, 2021

Conversation

mbali
Copy link
Contributor

@mbali mbali commented Nov 3, 2021

The Clojure API makes it simple to register custom function definitions by defining a new dispatch for the call-fn multimethod.

On Java side we do not have such an easy way to achieve this, without reimplementing API.render. I had multiple approaches in my mind:

  1. Registering one or more static function providers in FunctionEvaluator. This would change the global state, so it can have unexpected consequences.
  2. Amending the FunctionEvaluator instance during the render phase. I went with this approach.

I added a new API.render overload which accepts custom function implementations as its final parameter.
I also added test cases. NB: It looks like lein test does not run the jUnit tests in java-src.

@codecov
Copy link

codecov bot commented Nov 3, 2021

Codecov Report

Merging #101 (8bbb98d) into master (000ae43) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #101   +/-   ##
=======================================
  Coverage   93.00%   93.00%           
=======================================
  Files          25       25           
  Lines        1873     1873           
  Branches      107      107           
=======================================
  Hits         1742     1742           
  Misses         24       24           
  Partials      107      107           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 000ae43...8bbb98d. Read the comment docs.

@erdos erdos merged commit df26b65 into erdos:master Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants