Community
Participate
Working Groups
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);