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.
And add default method implementations delegating to the wrapped Img.
I lifted the methods to implement from an existing class implementing WrappedImg and Img with the delegation pattern.
I'm not sure this is actually a good idea. It would slightly reduce the flexibility of the
WrappedImg
interface, such that you could no longer implement the two interfaces with different type parameters e.g.WrappedImg< FloatType >
andImg< DoubleType >
. One scenario where you might want to do that, I guess, could be if you are creating adapter classes from one type to another? E.g. if we consider theConverters
utility method:And one can imagine a similar function accepting an
Img< A > source
instead and returns aWriteConvertedImg< A, B >
that implementsWrappedImg< A >
andImg< B >
.A way around that could be to instead introduce a new
interface WrappedImgImg< T > extends WrappedImg< T >, Img< T >
and have the default delegation methods at this layer. Then folks who want the convenience of these delegators could implementWrappedImgImg
instead of the two lower-level interfaces.Thoughts?