This repository was archived by the owner on Oct 26, 2026. It is now read-only.
Repository navigation
Improve Discovery Framework for use in Ops API - #51
Merged
Merged
Conversation
24 of 25 tasks
gselzer
force-pushed
the
scijava/scijava-discovery/simplification
branch
5 times, most recently
from
December 3, 2021 17:25
7d0a944 to
2cf3ff1
Compare
gselzer
force-pushed
the
scijava/scijava-discovery/simplification
branch
from
January 14, 2022 17:16
2cf3ff1 to
2d59829
Compare
StaticDiscoverer has been simplified and renamed TODO: For some reason, ConcatenateViewTest failed. WE should check that out
This is a long name
This allows people to register all OpInfos "contained" in a class through the syntax ops.register(ops.infosFrom(<your class instance here>)) It's somewhat readable
TODO: Make sure we don't get two instances of OpInfos using this along with the natural discovery of Ops.
ctrueden
force-pushed
the
scijava/scijava-discovery/simplification
branch
from
June 30, 2022 22:02
2d59829 to
0dca4e4
Compare
ctrueden
approved these changes
Jun 30, 2022
ctrueden
left a comment
Member
There was a problem hiding this comment.
I am happy with this as a big step forward! I like the transition from Discoverer as interface required for all types of discoveries, to Object as primary currency.
| } | ||
| } | ||
| catch (IOException exc) { | ||
| } catch (IOException exc) { |
Member
There was a problem hiding this comment.
What's going on with the curly braces here? Are we changing code styles?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR greatly simplifies the
DiscovererAPI, as well as adding some new functionality via staticDiscoverermethods. The highlights are listed below:Discoverer.all(): Returns allDiscoverers provided asServices, in addition to aDiscovererthat is backed byServiceLoader.Discoverer.union(Iterable<Discoverer> itr): allows the combination of multipleDiscoverers into one uber-DiscovererDiscoverer.onlyFor(Class<?>... classes): allows the usage ofDiscovererfor a subset of classes, very useful for backend implementation discovery (i.e. if you want to run anOpEnvironmentwith all knownMatchingRoutines, but not all knownOps.Discoverer.except()provides the reverse.These methods allow for powerful syntax like
This syntax is used in
AbstractTestEnvironmentto get all knownOpWrappers,MatchingRoutines,OpInfoGenerators, andInfoChainGenerators, and nothing else. This allows extending tests to obtain all of these useful backend implementations while removing the burden of being slowed down by all known Ops.The end goal of this PR was to make it easy for an
OpEnvironmentto take anObjectand extractOpInfos from it. To this end, the methodmakeDiscoverable(Object... objects)was added toOpEnvironment.TODO:
Closes scijava/scijava#80