cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: CAY-2268 DI: Refactor ListBuilder API ambiguities for before() / after() bindings
Date Tue, 21 Mar 2017 15:01:58 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 7901698c9 -> 9cc58c63f


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


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/9cc58c63
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/9cc58c63
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/9cc58c63

Branch: refs/heads/master
Commit: 9cc58c63fd1243d982dac4f00ac0270ba3b9efce
Parents: 7901698
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Tue Mar 21 16:14:57 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Tue Mar 21 16:14:57 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/cayenne/di/ListBuilder.java |  31 +++++-
 .../apache/cayenne/di/UnorderedListBuilder.java |  42 --------
 .../cayenne/di/spi/DefaultListBuilder.java      | 103 ++++++++++++-------
 .../org/apache/cayenne/di/spi/ListProvider.java |  43 ++++----
 .../di/spi/DefaultInjectorInjectionTest.java    |  63 +++++++-----
 .../cache/CacheInvalidationModuleBuilder.java   |   2 +-
 .../postcommit/PostCommitModuleBuilder.java     |   4 +-
 docs/doc/src/main/resources/RELEASE-NOTES.txt   |   1 +
 docs/doc/src/main/resources/UPGRADE.txt         |   4 +
 9 files changed, 154 insertions(+), 139 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/cayenne-di/src/main/java/org/apache/cayenne/di/ListBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/ListBuilder.java b/cayenne-di/src/main/java/org/apache/cayenne/di/ListBuilder.java
index 4088d4c..aaa90ee 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/ListBuilder.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/ListBuilder.java
@@ -16,34 +16,55 @@
  *  specific language governing permissions and limitations
  *  under the License.
  ****************************************************************/
+
 package org.apache.cayenne.di;
 
+import java.util.Collection;
+
 /**
  * A binding builder for list configurations.
  * 
  * @param <T> A type of list values.
  * @since 3.1
  */
-public interface ListBuilder<T> extends UnorderedListBuilder<T> {
+public interface ListBuilder<T> {
+
+    ListBuilder<T> add(Class<? extends T> interfaceType) throws DIRuntimeException;
+
+    ListBuilder<T> add(T value) throws DIRuntimeException;
+
+    ListBuilder<T> addAll(Collection<T> values) throws DIRuntimeException;
+
+    /**
+     * @since 4.0
+     */
+    ListBuilder<T> addAfter(Class<? extends T> interfaceType, Class<? extends
T> afterType) throws DIRuntimeException;
 
     /**
      * @since 4.0
      */
-    UnorderedListBuilder<T> after(Class<? extends T> type);
+    ListBuilder<T> addAfter(T value, Class<? extends T> afterType) throws DIRuntimeException;
 
     /**
      * @since 4.0
      */
-    UnorderedListBuilder<T> after(Key<? extends T> key);
+    ListBuilder<T> addAllAfter(Collection<T> values, Class<? extends T>
afterType) throws DIRuntimeException;
 
     /**
      * @since 4.0
      */
-    UnorderedListBuilder<T> before(Class<? extends T> type);
+    ListBuilder<T> insertBefore(Class<? extends T> interfaceType, Class<?
extends T> beforeType) throws DIRuntimeException;
 
     /**
      * @since 4.0
      */
-    UnorderedListBuilder<T> before(Key<? extends T> key);
+    ListBuilder<T> insertBefore(T value, Class<? extends T> beforeType) throws
DIRuntimeException;
+
+    /**
+     * @since 4.0
+     */
+    ListBuilder<T> insertAllBefore(Collection<T> values, Class<? extends T>
afterType) throws DIRuntimeException;
+
+    void in(Scope scope);
 
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/cayenne-di/src/main/java/org/apache/cayenne/di/UnorderedListBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/UnorderedListBuilder.java b/cayenne-di/src/main/java/org/apache/cayenne/di/UnorderedListBuilder.java
deleted file mode 100644
index 3287873..0000000
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/UnorderedListBuilder.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-
-package org.apache.cayenne.di;
-
-import java.util.Collection;
-
-/**
- * A binding builder for unordered list configurations.
- *
- * @param <T> A type of list values.
- * @since 4.0
- */
-public interface UnorderedListBuilder<T> {
-
-    ListBuilder<T> add(Class<? extends T> interfaceType) throws DIRuntimeException;
-
-    ListBuilder<T> add(T value) throws DIRuntimeException;
-
-    ListBuilder<T> add(Key<T> key, T object) throws DIRuntimeException;
-
-    ListBuilder<T> addAll(Collection<T> values) throws DIRuntimeException;
-
-    void in(Scope scope);
-
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java
index edf1b39..58549f2 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/DefaultListBuilder.java
@@ -23,7 +23,6 @@ import org.apache.cayenne.di.Key;
 import org.apache.cayenne.di.ListBuilder;
 import org.apache.cayenne.di.Provider;
 import org.apache.cayenne.di.Scope;
-import org.apache.cayenne.di.UnorderedListBuilder;
 
 import java.util.Collection;
 import java.util.LinkedHashMap;
@@ -50,77 +49,92 @@ class DefaultListBuilder<T> implements ListBuilder<T> {
     }
 
     @Override
-    public ListBuilder<T> add(Class<? extends T> interfaceType)
-            throws DIRuntimeException {
+    public ListBuilder<T> add(Class<? extends T> interfaceType) {
 
-        Key<? extends T> key = Key.get(interfaceType);
-        Binding<? extends T> binding = injector.getBinding(key);
+        Provider<? extends T> provider = getProvider(interfaceType);
+        getListProvider().add(Key.get(interfaceType), provider);
+        return this;
+    }
 
-        if (binding == null) {
-            return addWithBinding(interfaceType);
-        }
+    @Override
+    public ListBuilder<T> addAfter(Class<? extends T> interfaceType, Class<?
extends T> afterType) {
 
-        getListProvider().add(key, binding.getScoped());
+        Provider<? extends T> provider = getProvider(interfaceType);
+        getListProvider().addAfter(Key.get(interfaceType), provider, Key.get(afterType));
         return this;
     }
 
-    <K extends T> ListBuilder<T> addWithBinding(Class<K> interfaceType)
{
-        Key<K> key = Key.get(interfaceType);
-
-        Provider<K> provider0 = new ConstructorInjectingProvider<>(interfaceType,
injector);
-        Provider<K> provider1 = new FieldInjectingProvider<>(provider0, injector);
-        injector.putBinding(key, provider1);
+    @Override
+    public ListBuilder<T> insertBefore(Class<? extends T> interfaceType, Class<?
extends T> beforeType) {
 
-        getListProvider().add(key, injector.getProvider(key));
+        Provider<? extends T> provider = getProvider(interfaceType);
+        getListProvider().insertBefore(Key.get(interfaceType), provider, Key.get(beforeType));
         return this;
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public ListBuilder<T> add(T object) throws DIRuntimeException {
-
-        Provider<T> provider0 = new InstanceProvider<>(object);
-        Provider<T> provider1 = new FieldInjectingProvider<>(provider0, injector);
-
-        getListProvider().add(Key.get((Class<? extends T>)object.getClass(), String.valueOf(incrementer.getAndIncrement())),
provider1);
+    public ListBuilder<T> add(T value) {
+        Key<? extends T> key = Key.get((Class<? extends T>)value.getClass(),
+                String.valueOf(incrementer.getAndIncrement()));
+        getListProvider().add(key, createProvider(value));
         return this;
     }
 
+    @SuppressWarnings("unchecked")
     @Override
-    public ListBuilder<T> add(Key<T> key, T object) throws DIRuntimeException
{
-
-        Provider<T> provider0 = new InstanceProvider<>(object);
-        Provider<T> provider1 = new FieldInjectingProvider<>(provider0, injector);
-
-        getListProvider().add(key, provider1);
+    public ListBuilder<T> addAfter(T value, Class<? extends T> afterType) {
+        Key<? extends T> key = Key.get((Class<? extends T>)value.getClass(),
+                String.valueOf(incrementer.getAndIncrement()));
+        getListProvider().addAfter(key, createProvider(value), Key.get(afterType));
         return this;
     }
 
+    @SuppressWarnings("unchecked")
     @Override
-    public UnorderedListBuilder<T> after(Class<? extends T> type) {
-        return after(Key.get(type));
+    public ListBuilder<T> insertBefore(T value, Class<? extends T> beforeType)
{
+        Key<? extends T> key = Key.get((Class<? extends T>)value.getClass(),
+                String.valueOf(incrementer.getAndIncrement()));
+        getListProvider().insertBefore(key, createProvider(value), Key.get(beforeType));
+        return this;
     }
 
     @Override
-    public UnorderedListBuilder<T> after(Key<? extends T> key) {
-        getListProvider().after(key);
+    public ListBuilder<T> addAll(Collection<T> values) {
+        getListProvider().addAll(createProviderMap(values));
         return this;
     }
 
     @Override
-    public UnorderedListBuilder<T> before(Class<? extends T> type) {
-        return before(Key.get(type));
+    public ListBuilder<T> addAllAfter(Collection<T> values, Class<? extends
T> afterType) {
+        getListProvider().addAllAfter(createProviderMap(values), Key.get(afterType));
+        return this;
     }
 
     @Override
-    public UnorderedListBuilder<T> before(Key<? extends T> key) {
-        getListProvider().before(key);
+    public ListBuilder<T> insertAllBefore(Collection<T> values, Class<? extends
T> beforeType) {
+        getListProvider().insertAllBefore(createProviderMap(values), Key.get(beforeType));
         return this;
     }
 
-    @Override
-    public ListBuilder<T> addAll(Collection<T> objects) throws DIRuntimeException
{
+    private Provider<? extends T> getProvider(Class<? extends T> interfaceType)
+            throws DIRuntimeException {
+
+        Key<? extends T> key = Key.get(interfaceType);
+        Binding<? extends T> binding = injector.getBinding(key);
+        if (binding == null) {
+            return addWithBinding(interfaceType);
+        }
+        return binding.getScoped();
+    }
+
+    @SuppressWarnings("unchecked")
+    private Provider<T> createProvider(T value) {
+        Provider<T> provider0 = new InstanceProvider<>(value);
+        return new FieldInjectingProvider<>(provider0, injector);
+    }
 
+    private Map<Key<? extends T>, Provider<? extends T>> createProviderMap(Collection<T>
objects) {
         Map<Key<? extends T>, Provider<? extends T>> keyProviderMap = new
LinkedHashMap<>();
         for (T object : objects) {
             Provider<T> provider0 = new InstanceProvider<>(object);
@@ -131,8 +145,17 @@ class DefaultListBuilder<T> implements ListBuilder<T> {
             keyProviderMap.put(Key.get(objectType, String.valueOf(incrementer.getAndIncrement())),
provider1);
         }
 
-        getListProvider().addAll(keyProviderMap);
-        return this;
+        return keyProviderMap;
+    }
+
+    private <K extends T> Provider<? extends T> addWithBinding(Class<K>
interfaceType) {
+        Key<K> key = Key.get(interfaceType);
+
+        Provider<K> provider0 = new ConstructorInjectingProvider<>(interfaceType,
injector);
+        Provider<K> provider1 = new FieldInjectingProvider<>(provider0, injector);
+        injector.putBinding(key, provider1);
+
+        return injector.getProvider(key);
     }
 
     private ListProvider<T> getListProvider() {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ListProvider.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ListProvider.java b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ListProvider.java
index 400b331..83297cc 100644
--- a/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ListProvider.java
+++ b/cayenne-di/src/main/java/org/apache/cayenne/di/spi/ListProvider.java
@@ -36,13 +36,10 @@ class ListProvider<T> implements Provider<List<T>> {
 
     private Map<Key<? extends T>, Provider<? extends T>> providers;
     private DIGraph<Key<? extends T>> graph;
-    private Key<? extends T> lastKey;
-    private Collection<Key<? extends T>> lastKeys;
 
     public ListProvider() {
         this.providers = new HashMap<>();
         this.graph = new DIGraph<>();
-        this.lastKeys = Collections.emptySet();
     }
 
     @Override
@@ -72,38 +69,34 @@ class ListProvider<T> implements Provider<List<T>> {
     void add(Key<? extends T> key, Provider<? extends T> provider) {
         providers.put(key, provider);
         graph.add(key);
-        lastKey = key;
-        lastKeys.clear();
+    }
+
+    void addAfter(Key<? extends T> key, Provider<? extends T> provider, Key<?
extends T> after) {
+        providers.put(key, provider);
+        graph.add(key, after);
+    }
+
+    void insertBefore(Key<? extends T> key, Provider<? extends T> provider, Key<?
extends T> before) {
+        providers.put(key, provider);
+        graph.add(before, key);
     }
 
     void addAll(Map<Key<? extends T>, Provider<? extends T>> keyProviderMap)
{
         providers.putAll(keyProviderMap);
         graph.addAll(keyProviderMap.keySet());
-        lastKeys = keyProviderMap.keySet();
     }
 
-    void after(Key<? extends T> after) {
-        if (!lastKeys.isEmpty()) {
-            for (Key<? extends T> key : lastKeys) {
-                graph.add(key, after);
-            }
-
-            return;
+    void addAllAfter(Map<Key<? extends T>, Provider<? extends T>> keyProviderMap,
Key<? extends T> after) {
+        providers.putAll(keyProviderMap);
+        for (Key<? extends T> key : keyProviderMap.keySet()) {
+            graph.add(key, after);
         }
-
-        graph.add(lastKey, after);
     }
 
-    void before(Key<? extends T> before) {
-        if (!lastKeys.isEmpty()) {
-            for (Key<? extends T> key: lastKeys) {
-                graph.add(before, key);
-            }
-
-            return;
+    void insertAllBefore(Map<Key<? extends T>, Provider<? extends T>> keyProviderMap,
Key<? extends T> before) {
+        providers.putAll(keyProviderMap);
+        for (Key<? extends T> key : keyProviderMap.keySet()) {
+            graph.add(before, key);
         }
-
-        graph.add(before, lastKey);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorInjectionTest.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorInjectionTest.java
b/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorInjectionTest.java
index 6f4966b..27411e3 100644
--- a/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorInjectionTest.java
+++ b/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorInjectionTest.java
@@ -20,18 +20,36 @@ package org.apache.cayenne.di.spi;
 
 import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.Key;
-import org.apache.cayenne.di.ListBuilder;
 import org.apache.cayenne.di.Module;
-import org.apache.cayenne.di.mock.*;
+import org.apache.cayenne.di.mock.MockImplementation1;
+import org.apache.cayenne.di.mock.MockImplementation1Alt;
+import org.apache.cayenne.di.mock.MockImplementation1Alt2;
+import org.apache.cayenne.di.mock.MockImplementation1_ListConfiguration;
+import org.apache.cayenne.di.mock.MockImplementation1_ListConfigurationMock5;
+import org.apache.cayenne.di.mock.MockImplementation1_MapConfiguration;
+import org.apache.cayenne.di.mock.MockImplementation1_WithInjector;
+import org.apache.cayenne.di.mock.MockImplementation2;
+import org.apache.cayenne.di.mock.MockImplementation2Sub1;
+import org.apache.cayenne.di.mock.MockImplementation2_ConstructorProvider;
+import org.apache.cayenne.di.mock.MockImplementation2_ListConfiguration;
+import org.apache.cayenne.di.mock.MockImplementation2_Named;
+import org.apache.cayenne.di.mock.MockImplementation3;
+import org.apache.cayenne.di.mock.MockImplementation4;
+import org.apache.cayenne.di.mock.MockImplementation4Alt;
+import org.apache.cayenne.di.mock.MockImplementation4Alt2;
+import org.apache.cayenne.di.mock.MockImplementation5;
+import org.apache.cayenne.di.mock.MockInterface1;
+import org.apache.cayenne.di.mock.MockInterface2;
+import org.apache.cayenne.di.mock.MockInterface3;
+import org.apache.cayenne.di.mock.MockInterface4;
+import org.apache.cayenne.di.mock.MockInterface5;
 import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 public class DefaultInjectorInjectionTest {
@@ -267,14 +285,14 @@ public class DefaultInjectorInjectionTest {
                 binder.bind(MockInterface1.class).to(
                         MockImplementation1_ListConfiguration.class);
 
+                binder.bind(MockInterface5.class).to(MockImplementation5.class);
+
                 binder.bindList(Object.class, "xyz")
                         .add("1value")
                         .add("2value")
-                        .add(Key.get(Object.class, "5value"), "5value")
-                        .after(Key.get(Object.class, "4value"))
-                        .add("3value")
-                        .before(Key.get(Object.class, "4value"))
-                        .add(Key.get(Object.class, "4value"), "4value");
+                        .addAfter("5value", MockInterface5.class)
+                        .insertBefore("3value", MockInterface5.class)
+                        .add(MockInterface5.class);
             }
         };
 
@@ -282,7 +300,7 @@ public class DefaultInjectorInjectionTest {
 
         MockInterface1 service = injector.getInstance(MockInterface1.class);
         assertNotNull(service);
-        assertEquals(";1value;2value;3value;4value;5value", service.getName());
+        assertEquals(";1value;2value;3value;xyz;5value", service.getName());
     }
 
     @Test
@@ -302,13 +320,14 @@ public class DefaultInjectorInjectionTest {
                 secondList.add("6value");
                 secondList.add("7value");
                 secondList.add("8value");
+
+                binder.bind(MockInterface5.class).to(MockImplementation5.class);
+
                 binder.bindList(Object.class, "xyz")
-                        .add(Key.get(Object.class, "4value"), "4value")
-                        .addAll(firstList)
-                        .before(Key.get(Object.class, "4value"))
-                        .addAll(secondList)
-                        .after(Key.get(Object.class, "5value"))
-                        .add(Key.get(Object.class, "5value"), "5value");
+                        .insertAllBefore(firstList, MockInterface5.class)
+                        .addAllAfter(secondList, MockInterface5.class)
+                        .add("5value")
+                        .add(MockInterface5.class);
             }
         };
 
@@ -316,7 +335,7 @@ public class DefaultInjectorInjectionTest {
 
         MockInterface1 service = injector.getInstance(MockInterface1.class);
         assertNotNull(service);
-        assertEquals(";1value;2value;3value;4value;5value;6value;7value;8value", service.getName());
+        assertEquals(";1value;2value;3value;xyz;6value;7value;8value;5value", service.getName());
     }
 
     @Test
@@ -352,14 +371,10 @@ public class DefaultInjectorInjectionTest {
 
                 binder.bindList(Object.class, "xyz")
                         .add("1value")
-                        .add("5value")
-                        .before(MockInterface5.class)
+                        .insertBefore("5value", MockInterface5.class)
                         .add("2value")
-                        .add(Key.get(Object.class, "4value"), "4value")
-                        .add("6value")
-                        .after(MockInterface5.class)
+                        .addAfter("6value", MockInterface5.class)
                         .add("3value")
-                        .before(Key.get(Object.class, "4value"))
                         .add(MockInterface5.class);
             }
         };
@@ -368,7 +383,7 @@ public class DefaultInjectorInjectionTest {
 
         MockInterface1 service = injector.getInstance(MockInterface1.class);
         assertNotNull(service);
-        assertEquals(";1value;2value;3value;4value;5value;xyz;6value", service.getName());
+        assertEquals(";1value;2value;5value;xyz;6value;3value", service.getName());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationModuleBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationModuleBuilder.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationModuleBuilder.java
index 92d7993..7b3b6bb 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationModuleBuilder.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/cache/CacheInvalidationModuleBuilder.java
@@ -89,7 +89,7 @@ public class CacheInvalidationModuleBuilder {
 
                 // want the filter to be INSIDE transaction
                 ServerModule.contributeDomainFilters(binder)
-                        .add(CacheInvalidationFilter.class).before(TransactionFilter.class);
+                        .insertBefore(CacheInvalidationFilter.class, TransactionFilter.class);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
index 6158937..78efb63 100644
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
+++ b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/postcommit/PostCommitModuleBuilder.java
@@ -134,9 +134,9 @@ public class PostCommitModuleBuilder {
 				binder.bind(PostCommitFilter.class).to(PostCommitFilter.class);
 
 				if (excludeFromTransaction) {
-					ServerModule.contributeDomainFilters(binder).add(PostCommitFilter.class).after(TransactionFilter.class);
+					ServerModule.contributeDomainFilters(binder).addAfter(PostCommitFilter.class, TransactionFilter.class);
 				} else {
-					ServerModule.contributeDomainFilters(binder).add(PostCommitFilter.class).before(TransactionFilter.class);
+					ServerModule.contributeDomainFilters(binder).insertBefore(PostCommitFilter.class, TransactionFilter.class);
 				}
 			}
 		};

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index d658bae..197956b 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -19,6 +19,7 @@ CAY-2258 DI: type-safe binding of List and Map
 CAY-2266 Move EventBridge implementations into autoloadable modules
 CAY-2267 Contribute lifecycle events listeners via DI
 CAY-2259 QueryCache: support for referencing type-safe caches
+CAY-2268 DI: Refactor ListBuilder API ambiguities for before() / after() bindings
 CAY-2269 Add support for date/time components extraction in expression functions
 CAY-2270 Update function support in expression parser
 CAY-2271 ColumnSelect: support for prefetch and limit

http://git-wip-us.apache.org/repos/asf/cayenne/blob/9cc58c63/docs/doc/src/main/resources/UPGRADE.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/UPGRADE.txt b/docs/doc/src/main/resources/UPGRADE.txt
index 06e90ed..ff68183 100644
--- a/docs/doc/src/main/resources/UPGRADE.txt
+++ b/docs/doc/src/main/resources/UPGRADE.txt
@@ -7,6 +7,10 @@ IMPORTANT: be sure to read all notes for the intermediate releases between
your
 
 UPGRADING TO 4.0.M6
 
+* Per CAY-2268 DI methods for binding ordered lists, introduced in 4.0.M3 where changed:
+       - method after() replaced by explicit addAfter(), addAllAfter()
+       - method before() replaced by insertBefore(), insertAllBefore()
+
 * Per CAY-2258 Injection of List and Map are made type-safe, if you are using following methods:
         - bindMap(String bindingName)
         - bindList(String bindingName)


Mime
View raw message