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

DI: typesafe binding of List and Map

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.B1
    • Core Library

    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

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

            Dates

              Created:
              Updated:
              Resolved: