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

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

    XMLWordPrintableJSON

Details

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

    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

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

            Dates

              Created:
              Updated:
              Resolved: