Skip to content

Create Initializable#249

Closed
lnyng wants to merge 1 commit intomasterfrom
create-initializable
Closed

Create Initializable#249
lnyng wants to merge 1 commit intomasterfrom
create-initializable

Conversation

@lnyng
Copy link
Copy Markdown
Contributor

@lnyng lnyng commented Oct 15, 2016

See imagej-ops#455

This interface is moved from imagej-ops. It might be easier for the
underlying class inside the module to implement this interface than to
specify the initializer inside the Plugin annotation, especially because
annotation could not be partially overridden. Now the Initializable
interface has higher priority than the initializer annotation, and at
most one of them will be called when a module is initialized.

This interface is moved from imagej-ops. It might be easier for the
underlying class inside the module to implement this interface than to
specify the initializer inside the Plugin annotation, especially because
annotation could not be partially overridden. Now the Initializable
interface has higher priority than the initializer annotation, and at
most one of them will be called when a module is initialized.
Copy link
Copy Markdown
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.

Looks nice.

You could consider adding Initializable as one commit, and then updating the AbstractModule separately, although I do not feel strongly about it.

Please address my two review comments, though.

if (delegateObject instanceof Initializable) {
((Initializable) delegateObject).initialize();
}
else {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need to do either/or here? If so, we should issue a warning when the module implements Initializable and declares an initializer method. Or simpler: why not just run both initializers if both are available/specified?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is also a question of handling the case where the Module itself is Initializable. This can happen e.g. for modules which extend AbstractModule directly. I think we should check that instead, and then have CommandModule implement Initializable, working analogously to how support works for Cancelable.

* #%L
* ImageJ software for multidimensional image processing and analysis.
* %%
* Copyright (C) 2014 - 2016 Board of Regents of the University of
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This copyright header should be updated to match the rest of SJC.

@ctrueden ctrueden closed this in 60ef945 May 5, 2017
@ctrueden ctrueden deleted the create-initializable branch May 5, 2017 19:28
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.

2 participants