james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [04/12] james-project git commit: JAMES-2161 Keywords factories can be constants
Date Tue, 27 Nov 2018 02:06:31 GMT
JAMES-2161 Keywords factories can be constants


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

Branch: refs/heads/master
Commit: a4d5cc40d268fef6be17a4f9fda9ac283ffb6e45
Parents: 017f357
Author: Benoit Tellier <btellier@linagora.com>
Authored: Fri Nov 23 16:38:17 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Tue Nov 27 09:01:54 2018 +0700

----------------------------------------------------------------------
 .../java/org/apache/james/jmap/model/Keywords.java  | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a4d5cc40/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keywords.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keywords.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keywords.java
index c77b602..24ef90e 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keywords.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keywords.java
@@ -46,6 +46,14 @@ public class Keywords {
 
     public static final Keywords DEFAULT_VALUE = new Keywords(ImmutableSet.of());
     private static final Logger LOGGER = LoggerFactory.getLogger(Keywords.class);
+    private static final KeywordsFactory STRICT_KEYWORDS_FACTORY = new KeywordsFactory(
+        KeywordsFactory.KeywordsValidator.THROW_ON_IMAP_NON_EXPOSED_KEYWORDS,
+        KeywordsFactory.KeywordFilter.KEEP_ALL,
+        KeywordsFactory.ToKeyword.STRICT);
+    private static final KeywordsFactory LENIENT_KEYWORDS_FACTORY = new KeywordsFactory(
+        KeywordsFactory.KeywordsValidator.IGNORE_NON_EXPOSED_IMAP_KEYWORDS,
+        KeywordsFactory.KeywordFilter.FILTER_IMAP_NON_EXPOSED_KEYWORDS,
+        KeywordsFactory.ToKeyword.LENIENT);
 
     private FlagsBuilder combiner(FlagsBuilder firstBuilder, FlagsBuilder secondBuilder)
{
         return firstBuilder.add(secondBuilder.build());
@@ -140,15 +148,11 @@ public class Keywords {
     }
 
     public static KeywordsFactory strictFactory() {
-        return new KeywordsFactory(KeywordsFactory.KeywordsValidator.THROW_ON_IMAP_NON_EXPOSED_KEYWORDS,
-            KeywordsFactory.KeywordFilter.KEEP_ALL,
-            KeywordsFactory.ToKeyword.STRICT);
+        return STRICT_KEYWORDS_FACTORY;
     }
 
     public static KeywordsFactory lenientFactory() {
-        return new KeywordsFactory(KeywordsFactory.KeywordsValidator.IGNORE_NON_EXPOSED_IMAP_KEYWORDS,
-            KeywordsFactory.KeywordFilter.FILTER_IMAP_NON_EXPOSED_KEYWORDS,
-            KeywordsFactory.ToKeyword.LENIENT);
+        return LENIENT_KEYWORDS_FACTORY;
     }
 
     private final ImmutableSet<Keyword> keywords;


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


Mime
View raw message