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

Therapi-based Discovery #44

Merged
merged 11 commits into from
Apr 13, 2022
Merged

Conversation

gselzer
Copy link
Member

@gselzer gselzer commented Oct 18, 2021

This PR adds a Therapi-based Op Discovery mechanism via the new scijava/scijava-discovery-therapi module. This module enables "element-tagged" discovery through the use of the @implNote javadoc tag.

How do I declare an Op using Therapi?

  1. Enable therapi annotation processing in your POM.
  2. Add an @implNote to any Class, Method or Field. The @implNote annotation should be followed with (1) the tag type (i.e. the keyword under which this AnnotatedElement will become discoverable) and (2) any (comma-delineated) key-value pairs that should be scraped with the tag.

Note that the tags are parsed using Parsington, as the org.scijava.parse package from SciJava Common was moved into the incubator and modularized into SciJava Parse2.

An Op written as a Field discoverable using therapi might look like:

/**
 * @implNote op names='foo', priority='100'
 */
public final Function<Integer, Integer> fooOp = (in) -> {...};

Ops written as Methods require a type option:

/**
 * @implNote op names='bar', type='java.util.function.Function'
 **/
public static Integer bar(Integer in) { ... }

This PR also refactors the Discoverer and Discovery API from SciJava Discovery to make the discovery returns much more powerful.

Furthermore, this PR also introduces SciJava Parse2 to the incubator, partitioning out org/scijava/parse from SciJava Common.

Closes scijava/scijava#77

@gselzer gselzer requested a review from ctrueden October 18, 2021 18:21
@gselzer gselzer force-pushed the scijava/scijava-ops-engine/therapi-discoverer branch 2 times, most recently from 6dd64d8 to 347e3be Compare October 18, 2021 19:36
@gselzer
Copy link
Member Author

gselzer commented Oct 18, 2021

Note: This is the first step towards completing scijava/scijava#56

@gselzer gselzer force-pushed the scijava/scijava-ops-engine/therapi-discoverer branch from 347e3be to b6ece7b Compare October 18, 2021 21:04
@gselzer gselzer force-pushed the scijava/scijava-ops-engine/therapi-discoverer branch from b6ece7b to fb7d30c Compare November 16, 2021 19:19
@ctrueden ctrueden self-assigned this Nov 22, 2021
gselzer added 8 commits April 13, 2022 12:10
This commit provides major changes to the Discoverer interface.
1. We rename implementingClasses to implsOfType
2. We add the elementsTaggedWith(String key) method
3. We make both elements default, so that Discoverers can decide to
implement only one of the two methods.
This commit also refactors the OpInfo implementations to prevent them
from definning the Hints and priority. We might want to define these
using something other than an annotation...
@ctrueden ctrueden force-pushed the scijava/scijava-ops-engine/therapi-discoverer branch from fb7d30c to e303bc5 Compare April 13, 2022 17:25
@ctrueden ctrueden force-pushed the scijava/scijava-ops-engine/therapi-discoverer branch from e303bc5 to d0d8479 Compare April 13, 2022 17:32
Copy link
Member

@ctrueden ctrueden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@ctrueden ctrueden merged commit 283e7f8 into main Apr 13, 2022
@ctrueden ctrueden deleted the scijava/scijava-ops-engine/therapi-discoverer branch April 13, 2022 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Create a Therapi-based Discoverer for Ops
2 participants