cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nikita Timofeev <ntimof...@objectstyle.com>
Subject Changes in DI ListBuilder API
Date Thu, 16 Mar 2017 07:50:03 GMT
Hi all,

One more thing I want to change in the existing DI API.
This time it's about creating ordered List binding.

There are some problems and ambiguities with new 4.0 DI 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);


-- 
Best regards,
Nikita Timofeev

Mime
View raw message