You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (JIRA)" <ji...@apache.org> on 2017/03/16 07:46:41 UTC

[jira] [Created] (CAY-2268) DI: Refactor ListBuilder API ambiguities for before() / after() bindings

Nikita Timofeev created CAY-2268:
------------------------------------

             Summary: DI: Refactor ListBuilder API ambiguities for before() / after() bindings
                 Key: CAY-2268
                 URL: https://issues.apache.org/jira/browse/CAY-2268
             Project: Cayenne
          Issue Type: Improvement
          Components: Core Library
            Reporter: Nikita Timofeev
            Assignee: Nikita Timofeev
             Fix For: 4.0.M6


There are some problems and ambiguities with API for adding ordered dependencies:
# you can call {{after()}} / {{before()}} without adding anything first, that will cause NPE
# right order of calls is not clear: {{add().after()}} or {{after().add()}}

Suggested API modification:
# remove {{UnorderedListBuilder}}, keep everything in {{ListBuilder}}
# add methods with explicit before\after parameters:
{code}
    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);
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)