This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 50b76a8091de14b04d273a34ad22a20ac4ebd0ed
Author: Benoit Tellier <btell...@linagora.com>
AuthorDate: Mon Dec 2 11:27:27 2019 +0700

    JAMES-2997 Introduce MessageFastViewPrecomputedProperties POJO
    
    For now this only contains a Preview. In the really close future this
    will contain also the 'hasAttachment' property.
---
 .../MessageFastViewPrecomputedProperties.java      | 75 ++++++++++++++++++++++
 .../MessageFastViewPrecomputedPropertiesTest.java  | 32 +++++++++
 2 files changed, 107 insertions(+)

diff --git 
a/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/preview/MessageFastViewPrecomputedProperties.java
 
b/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/preview/MessageFastViewPrecomputedProperties.java
new file mode 100644
index 0000000..bf814f8
--- /dev/null
+++ 
b/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/preview/MessageFastViewPrecomputedProperties.java
@@ -0,0 +1,75 @@
+/****************************************************************
+ * 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.james.jmap.api.preview;
+
+import java.util.Objects;
+
+import com.google.common.base.Preconditions;
+
+public class MessageFastViewPrecomputedProperties {
+    public static class Builder {
+        @FunctionalInterface
+        public interface RequirePreview {
+            FinalStage preview(Preview preview);
+        }
+
+        public static class FinalStage {
+            private final Preview preview;
+
+            private FinalStage(Preview preview) {
+                Preconditions.checkNotNull(preview, "'preview' cannot be 
null");
+                this.preview = preview;
+            }
+
+            public MessageFastViewPrecomputedProperties build() {
+                return new MessageFastViewPrecomputedProperties(preview);
+            }
+        }
+    }
+
+    public static Builder.RequirePreview builder() {
+        return preview -> new Builder.FinalStage(preview);
+    }
+
+    private final Preview preview;
+
+    private MessageFastViewPrecomputedProperties(Preview preview) {
+        this.preview = preview;
+    }
+
+    public Preview getPreview() {
+        return preview;
+    }
+
+    @Override
+    public final boolean equals(Object o) {
+        if (o instanceof MessageFastViewPrecomputedProperties) {
+            MessageFastViewPrecomputedProperties that = 
(MessageFastViewPrecomputedProperties) o;
+
+            return Objects.equals(this.preview, that.preview);
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return Objects.hash(preview);
+    }
+}
diff --git 
a/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/preview/MessageFastViewPrecomputedPropertiesTest.java
 
b/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/preview/MessageFastViewPrecomputedPropertiesTest.java
new file mode 100644
index 0000000..fe0064f
--- /dev/null
+++ 
b/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/preview/MessageFastViewPrecomputedPropertiesTest.java
@@ -0,0 +1,32 @@
+/****************************************************************
+ * 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.james.jmap.api.preview;
+
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+class MessageFastViewPrecomputedPropertiesTest {
+    @Test
+    void shouldMatchBeanContract() {
+        EqualsVerifier.forClass(MessageFastViewPrecomputedProperties.class)
+            .verify();
+    }
+}
\ No newline at end of file


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

Reply via email to