In C# you can enclose a lambda expression in an expression tree object and then possibly parse it. I was wondering if this is also possible in Java?
What I'm looking for is doing something like this:
BooksRepository.getAll()
.where(b -> b.getIban() == "SomeIban")
.and(b -> b.getAuthor() == "SomeAuthor"); //etc.
And then the BooksRepository
should somehow translate that query to the following RESTful API request based on the predicates specified as lambdas:
GET http://mylibrary.com/books?Iban=SomeIban&Author=SomeAuthor
and then return the result to the client. Any idea if this is even possible in Java?
Yes, it's possible. I made a library that does exactly that: JaQue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With