Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2258

DI: typesafe binding of List and Map

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.B1
    • Component/s: Core Library
    • Labels:

      Description

      The goal of this improvement is to add compile time type-safety to dependency injection of Lists and Maps.

      Proposed changes in DI API:
      Add following methods in Binder interface

          <T> MapBuilder<T> bindMap(Class<T> valueType);
          <T> MapBuilder<T> bindMap(Class<T> valueType, String bindingName);
          <T> ListBuilder<T> bindList(Class<T> valueType, String bindingName);
          <T> ListBuilder<T> bindList(Class<T> valueType);
      

      And deprecate non type-safe methods:

          <T> MapBuilder<T> bindMap(String bindingName);
          <T> ListBuilder<T> bindList(String bindingName);
      

      Incompatibility
      If Cayenne DI is used in third-party code (custom modules or Cayenne modifications) the code should be updated if bindings other than List<Object> and Map<String, Object> were used, as this code will be broken.

        Attachments

          Activity

            People

            • Assignee:
              ntimofeev Nikita Timofeev
              Reporter:
              ntimofeev Nikita Timofeev
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: