Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds io.vavr support, fixing #71 #75

Merged
merged 2 commits into from
Jun 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adds io.vavr support, fixing #71
  • Loading branch information
talios committed Jun 6, 2017
commit 02bdd2a54eef710a60b579b8d465d7dda1a6799e
10 changes: 10 additions & 0 deletions annotation/src/main/java/org/derive4j/Flavour.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ public <R> R match(Cases<R> cases) {
}
},

Vavr {
@Override
public <R> R match(Cases<R> cases) {

return cases.Vavr();
}
},

HighJ {
@Override
public <R> R match(Cases<R> cases) {
Expand Down Expand Up @@ -88,6 +96,8 @@ public interface Cases<R> {

R Javaslang();

R Vavr();

R HighJ();

R Guava();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ final class DeriveUtilsImpl implements DeriveUtils {
.Fugue_(jdkSupplier)
.Fugue2_(guavaSupplier)
.Javaslang_(jdkSupplier)
.Vavr_(jdkSupplier)
.HighJ_(jdkSupplier)
.Guava_(guavaSupplier);

Expand All @@ -182,6 +183,7 @@ final class DeriveUtilsImpl implements DeriveUtils {
.Fugue_(jdkFunction)
.Fugue2_(guavaFunction)
.Javaslang_(lazySamInterface("javaslang.Function1"))
.Vavr_(lazySamInterface("io.vavr.Function1"))
.HighJ_(lazySamInterface("org.highj.function.F1"))
.Guava_(guavaFunction);

Expand All @@ -191,6 +193,7 @@ final class DeriveUtilsImpl implements DeriveUtils {
.Fugue_(lazyOptionModel("io.atlassian.fugue.Option", "none", "some"))
.Fugue2_(lazyOptionModel("com.atlassian.fugue.Option", "none", "some"))
.Javaslang_(lazyOptionModel("javaslang.control.Option", "none", "some"))
.Vavr_(lazyOptionModel("io.vavr.control.Option", "none", "some"))
.HighJ_(lazyOptionModel("org.highj.data.Maybe", "Nothing", "Just"))
.Guava_(lazyOptionModel("com.google.common.base.Optional", "absent", "of"));

Expand All @@ -200,6 +203,7 @@ final class DeriveUtilsImpl implements DeriveUtils {
.Fugue_(eitherModel("io.atlassian.fugue.Either", "left", "right"))
.Fugue2_(eitherModel("com.atlassian.fugue.Either", "left", "right"))
.Javaslang_(eitherModel("javaslang.control.Either", "left", "right"))
.Vavr_(eitherModel("io.vavr.control.Either", "left", "right"))
.HighJ_(eitherModel("org.highj.data.Either", "Left", "Right"))
.Guava_(Optional.empty());
}
Expand Down