aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/pacien/lemonad/validation/ValidationResultContainer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/pacien/lemonad/validation/ValidationResultContainer.java')
-rw-r--r--src/main/java/org/pacien/lemonad/validation/ValidationResultContainer.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/org/pacien/lemonad/validation/ValidationResultContainer.java b/src/main/java/org/pacien/lemonad/validation/ValidationResultContainer.java
new file mode 100644
index 0000000..2c752f6
--- /dev/null
+++ b/src/main/java/org/pacien/lemonad/validation/ValidationResultContainer.java
@@ -0,0 +1,40 @@
1/*
2 * lemonad - Some functional sweetness for Java
3 * Copyright (C) 2019 Pacien TRAN-GIRARD
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19package org.pacien.lemonad.validation;
20
21import java.util.List;
22
23import lombok.NonNull;
24import lombok.Value;
25
26/**
27 * @author pacien
28 */
29@Value class ValidationResultContainer<S, E> implements ValidationResult<S, E> {
30 S subject;
31 @NonNull List<E> errors;
32
33 @Override public boolean isValid() {
34 return errors.isEmpty();
35 }
36
37 @Override public boolean isInvalid() {
38 return !isValid();
39 }
40}