Skip to content

Instantly share code, notes, and snippets.

@mindwing
Created June 8, 2016 05:27
Show Gist options
  • Save mindwing/59233b5b837d2111345e575e73aac408 to your computer and use it in GitHub Desktop.
Save mindwing/59233b5b837d2111345e575e73aac408 to your computer and use it in GitHub Desktop.
Agera Explained - 08.Incrementally Agerifying legacy code
Result<ResponseBlob> noResponse = Result.absent();
Function<Throwable, Result<ResponseBlob>> withNoResponse =
Functions.staticFunction(noResponse);
Repository<Result<ResponseBlob>> responseRepository =
Repositories.repositoryWithInitialValue(noResponse)
.observe(requestVariable)
.onUpdatesPerLoop()
// .getFrom(requestVariable) if it does not supply Result, OR:
.attemptGetFrom(requestVariable).orEnd(withNoResponse)
.goTo(networkingExecutor)
.thenTransform(networkCallingFunction)
.compile();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment