diff options
author | pacien | 2019-03-29 01:31:15 +0100 |
---|---|---|
committer | pacien | 2019-03-29 01:31:15 +0100 |
commit | b6869c1b17c65594f65c3ad5e53461082e5c3088 (patch) | |
tree | 1b924d802852efbbc0519210fb947b095ddf48b4 /src/main/java/org/pacien/lemonad/attempt/Success.java | |
parent | eadf4a9f3c7d539f1af08ee37928ad0f80f4e4d3 (diff) | |
download | java-lemonad-b6869c1b17c65594f65c3ad5e53461082e5c3088.tar.gz |
initial impl
Diffstat (limited to 'src/main/java/org/pacien/lemonad/attempt/Success.java')
-rw-r--r-- | src/main/java/org/pacien/lemonad/attempt/Success.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/java/org/pacien/lemonad/attempt/Success.java b/src/main/java/org/pacien/lemonad/attempt/Success.java new file mode 100644 index 0000000..928fbb1 --- /dev/null +++ b/src/main/java/org/pacien/lemonad/attempt/Success.java | |||
@@ -0,0 +1,42 @@ | |||
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 | |||
19 | package org.pacien.lemonad.attempt; | ||
20 | |||
21 | import java.util.NoSuchElementException; | ||
22 | |||
23 | import lombok.Value; | ||
24 | |||
25 | /** | ||
26 | * @author pacien | ||
27 | */ | ||
28 | @Value class Success<R, E> implements Attempt<R, E> { | ||
29 | R result; | ||
30 | |||
31 | @Override public boolean isSuccess() { | ||
32 | return true; | ||
33 | } | ||
34 | |||
35 | @Override public boolean isFailure() { | ||
36 | return false; | ||
37 | } | ||
38 | |||
39 | @Override public E getError() { | ||
40 | throw new NoSuchElementException(); | ||
41 | } | ||
42 | } | ||