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

DI: Refactor ListBuilder API ambiguities for before() / after() bindings

    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

      There are some problems and ambiguities with API for adding ordered dependencies:

      1. you can call after() / before() without adding anything first, that will cause NPE
      2. right order of calls is not clear: add().after() or after().add()

      Suggested API modification:

      1. remove UnorderedListBuilder, keep everything in ListBuilder
      2. add methods with explicit before\after parameters:
            ListBuilder<T> addAfter(Class<? extends T> interfaceType, Class<? extends T> afterType);
        
            ListBuilder<T> addAfter(T value, Class<? extends T> afterType);
        
            ListBuilder<T> addAllAfter(Collection<T> values, Class<? extends T> afterType);
        
            ListBuilder<T> insertBefore(Class<? extends T> interfaceType, Class<? extends T> beforeType);
        
            ListBuilder<T> insertBefore(T value, Class<? extends T> beforeType);
        
            ListBuilder<T> insertAllBefore(Collection<T> values, Class<? extends T> beforeType);
        

        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: