You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/01/08 08:00:55 UTC

[36/47] james-project git commit: JAMES-2636 Reorder RecipientRewriteTable API order

JAMES-2636 Reorder RecipientRewriteTable API order

Classes go first, then constants, then methods. Note that I inlined a
short method that was not related to the API. This avoids poluting the API
with useless methods


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/887f3c5a
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/887f3c5a
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/887f3c5a

Branch: refs/heads/master
Commit: 887f3c5aa9d4f31cfeedee54d2ebf37f0f77e8ea
Parents: 9a4ce2f
Author: Benoit Tellier <bt...@linagora.com>
Authored: Fri Jan 4 09:43:42 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Tue Jan 8 14:45:33 2019 +0700

----------------------------------------------------------------------
 .../james/rrt/api/RecipientRewriteTable.java    | 48 ++++++++------------
 1 file changed, 19 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/887f3c5a/server/data/data-api/src/main/java/org/apache/james/rrt/api/RecipientRewriteTable.java
----------------------------------------------------------------------
diff --git a/server/data/data-api/src/main/java/org/apache/james/rrt/api/RecipientRewriteTable.java b/server/data/data-api/src/main/java/org/apache/james/rrt/api/RecipientRewriteTable.java
index fed9ea0..5c85ed7 100644
--- a/server/data/data-api/src/main/java/org/apache/james/rrt/api/RecipientRewriteTable.java
+++ b/server/data/data-api/src/main/java/org/apache/james/rrt/api/RecipientRewriteTable.java
@@ -34,6 +34,24 @@ import com.google.common.base.Preconditions;
  * Interface which should be implemented of classes which map recipients.
  */
 public interface RecipientRewriteTable {
+    class ErrorMappingException extends Exception {
+        private static final long serialVersionUID = 2348752938798L;
+
+        public ErrorMappingException(String string) {
+            super(string);
+        }
+    }
+
+    class TooManyMappingException extends ErrorMappingException {
+        public TooManyMappingException(String string) {
+            super(string);
+        }
+    }
+
+    EnumSet<Mapping.Type> listSourcesSupportedType = EnumSet.of(
+        Mapping.Type.Group,
+        Mapping.Type.Forward,
+        Mapping.Type.Address);
 
     void addMapping(MappingSource source, Mapping mapping) throws RecipientRewriteTableException;
 
@@ -91,7 +109,7 @@ public interface RecipientRewriteTable {
     Map<MappingSource, Mappings> getAllMappings() throws RecipientRewriteTableException;
 
     default List<MappingSource> listSources(Mapping mapping) throws RecipientRewriteTableException {
-        Preconditions.checkArgument(supportsSourceListing(mapping),
+        Preconditions.checkArgument(listSourcesSupportedType.contains(mapping.getType()),
             String.format("Not supported mapping of type %s", mapping.getType()));
 
         return getAllMappings().entrySet().stream()
@@ -99,32 +117,4 @@ public interface RecipientRewriteTable {
             .map(Map.Entry::getKey)
             .collect(Guavate.toImmutableList());
     }
-
-    EnumSet<Mapping.Type> listSourcesSupportedType = EnumSet.of(
-        Mapping.Type.Group,
-        Mapping.Type.Forward,
-        Mapping.Type.Address);
-
-    default boolean supportsSourceListing(Mapping mapping) {
-        return listSourcesSupportedType.contains(
-            mapping.getType());
-    }
-
-    class ErrorMappingException extends Exception {
-
-        private static final long serialVersionUID = 2348752938798L;
-
-        public ErrorMappingException(String string) {
-            super(string);
-        }
-
-    }
-
-    class TooManyMappingException extends ErrorMappingException {
-        
-        public TooManyMappingException(String string) {
-            super(string);
-        }
-
-    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org