Actionable involves both concrete implementation (including the instance field actions, set to an empty list whenever actions are retrieved) which may not be appropriate for all cases, and implements some interfaces related to model objects which are also not appropriate for all cases. (For example, it leaves SearchItem.getSearchUrl() abstract.)
It would be desirable to have a new API interface (implemented by Actionable) which cleanly represents the ability of an object to be decorated by actions: principally getAction(Class), but also getAllActions() and getActions(Class). An extended interface could describe the ability to have an action list be externally mutated (addAction(Action), replaceAction(Action), and perhaps a remove method to satisfy the occasional caller currently mutating the return value of getActions()).
TransientActionFactory could perhaps restrict its type parameter to the new (base, immutable) interface, and/or introduce some helper methods for searching factories.
- is blocking
-
JENKINS-33309 Make SCMHead Actionable
- Resolved
- is related to
-
JENKINS-26091 Marker interface for things with URL
- Open