Created
May 18, 2017 03:02
-
-
Save maarek/44104fab9aa0a35a4438cfb7b6fbea6e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to do this functional flow in Javaslang/Vavr | |
Response response = new PersonValidator().validatePerson("First", "Last"); // Returns Validation<Seq<String>, Person> | |
// success -> Try.of(() -> sendToMoon(Person)) // Throws Exception or returns void | |
// trySuccess -> Response.ok().build() | |
// tryFailure -> Response.Status(BadRequest).entity(throwable).build() | |
// failure -> Response.Status(BAD_REQUEST).entity(validatorStringsAppended).build() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment