stephanenicolas / robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Apache License 2.0
2.95k stars 545 forks source link

Add "execute" method which could get Lambdas. #427

Open georgeci opened 9 years ago

georgeci commented 9 years ago

As:

getSpiceManager().execute(request, response -> someWork(response), spiceException -> onError(spiceException ));
nkeskinov commented 9 years ago

Lambdas are not yet supported in Android.

georgeci commented 9 years ago

https://github.com/evant/gradle-retrolambda I use lambdas in my Android project. I can do pull-request with this, but not soon.

nkeskinov commented 9 years ago

That would (not too necessarily) add a dependency to another project/plugin. Developers who use lambdas may always extend their SpiceManager to include a lambda construct like you proposed. Also, RoboSpice is very open for contributors and this is a fine case for creating an extension.

georgeci commented 9 years ago

I wrote it but I thought that to have the opportunity out of the box is good idea https://gist.github.com/georgeci/4229e8142f6ff6306521

nkeskinov commented 9 years ago

Nice! I would still suggest doing an extension as lambdas are not the most standard constructs in Android and using them does not add anything to the core behavior of RoboSpice. Reopened the issue so that we can have anyone else's feedback.

stephanenicolas commented 9 years ago

Hi guys, I agree it would be a nice addition. Extensions in RS are designed for this kind of things.. (I say this to reconciliate @nkeskinov concern of not adding this to the core and still adding the feature). In that case, how could we make it so that this extension can be combined with any others ? (without having to double every single module).

I am sorry not to be very active. But still, I got ideas to extend RS but don't have time to work on that now.