Community
Participate
Working Groups
I wrote a snippet today to see if an array of required capabilities is satisfied by an IU. It would be cool if an IU had a method like iu.satisfies(RequiredCapability [] requirements) There are probably other helpers like this that would be nice. I don't mind writing them but I observe lots of similar code throughout the core, and it would be worth a review pass to look for places where helpers would consolidate the code. For example, just look for references to getProvidedCapabilities() and you'll see lots of similar code. (As a side note, I see places where ProvidedCapability.isSatisifiedBy could be used. For example, >Picker.findInstallableUnit(id, range, searchedCapability, fragmentsOnly) could be calling this method instead of doing the same check internally.
Susan, do you think this got addressed?
I think there are less repetitions of the code pattern now that we have some generalized queries for capabilities. I would like to see the following happen: - rename ProvidedCapability.isSatisifiedBy(RequiredCapability cap) to ProvidedCapability.satisfies(RequiredCapability cap) See the //TODO comment in the code. This came up again recently in the mailing list. - add a method IInstallableUnit.satisfies(RequiredCapability cap) which will iterate the provided capabilities and call the method. This is a API cleanup item. The rename is more important than the additional helper.
I got onto doing some miscellaneous API cleanup today, so I'll take this. Since there will be massive API change in M3 we might as well get easy ones like this out of the way now.
I have renamed isSatisfiedBy to satisfies, and added the same helper method to IInstallableUnit. I changed several references to use this new helper, which eliminated (hid) several for loops.
Tests added to InstallableUnitTest