Bug 517150 - Support marking of adapter bindings as overriding in order to replace already existing bindings for the same AdapterKey.
Summary: Support marking of adapter bindings as overriding in order to replace already...
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF Common (show other bugs)
Version: 1.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-23 14:04 EDT by Matthias Wienand CLA
Modified: 2017-05-23 14:04 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Wienand CLA 2017-05-23 14:04:38 EDT
Currently, adapter bindings can only be added, they cannot be removed or changed. Therefore, it is impossible to specify a set of default bindings for a base type, of which some are replaced for more specific types. Instead, no default bindings can be defined for the base type, and all bindings need to be defined for the specific sub types. Trying to replace bindings for a sub type results in an error.

As a solution, an adapter binding could be marked as "overriding", i.e. that it is allowed to replace a prior binding. This could be done by equipping the AdapterKey with an "overriding" field that can be set by chaining an #overriding() call after creation of an AdapterKey, as follows:

baseTypeAdapterMapBinder.addBinding(AdapterKey.defaultRole()).to(GeneralResizePolicy.class);
specificAdapterMapBinder.addBinding(AdapterKey.defaultRole().overriding()).to(SpecificResizePolicy.class);