Skip to content

Conversation

dscho
Copy link
Contributor

@dscho dscho commented Dec 14, 2013

The DefaultSingletonService used to instantiate all the plugins matching
the given type, but one might want to narrow down what becomes a
singleton even further, e.g. when ImageJ2 is looking for the current
platform: it wants to instantiate all plugins implementing the Platform
class, but then only keep the one that claims that it matches the
current platform.

Therefore, let's introduce the filterInstances(List) method that
returns the unmodified list of instances by default, but can be
overridden in subclasses.

Signed-off-by: Johannes Schindelin johannes.schindelin@gmx.de

The DefaultSingletonService used to instantiate all the plugins matching
the given type, but one might want to narrow down what becomes a
singleton even further, e.g. when ImageJ2 is looking for the current
platform: it wants to instantiate all plugins implementing the Platform
class, but then only keep the one that claims that it matches the
current platform.

Therefore, let's introduce the filterInstances(List<PT>) method that
returns the unmodified list of instances by default, but can be
overridden in subclasses.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
dscho added a commit that referenced this pull request Dec 14, 2013
Allow filtering instances before they become singletons
@dscho dscho merged commit f83f0b3 into master Dec 14, 2013
@dscho dscho deleted the singleton-service branch December 14, 2013 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant