Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:50:08+00:00 2026-06-13T21:50:08+00:00

Lambdaj (and some other similar libraries) provides a having function which allows me to

  • 0

Lambdaj (and some other similar libraries) provides a having function which allows me to define predicates like so (example directly from the lambdaj Features page):

List<Person> oldFriends = 
    filter(having(on(Person.class).getAge(), greaterThan(30)), meAndMyFriends);

I’d quite like to be able to define my Java predicate object using a straightforward string syntax, "age > 30" – similar to a SQL where clause – so the filter above becomes something like:

List<Person> oldFriends = 
    filter(having(Person.class, "age > 30"), meAndMyFriends);

Does such a library exist, or can anyone recommend some building blocks for the query parsing part I could use to build one myself? I don’t actually mind what kind of predicate (hamcrest, guava etc) it creates.

Off the top of my head I can think of a number of things it would be awesome for it to support: equalities and inequalities, on custom and primitive types, and/or/not, parentheses, LIKE (for Strings), in(...), interpretiation of enum names, properties of properties.

Here’s an example of a more complex predicate:

"salesCount > 10 and (country='UK' or city='New York')
and attitude not in (MENACING, RUDE)
and product.name <> 'Widget' "

(This example assumes that the class the predicate is applied to (say a SalesPerson class) has methods getSalesCount(), getCountry(), and getCity(), as well as getAttitude() (which returns an enum). It also has a property getProduct which returns a type with method getName).

Motivation: we have a client-server system that has multiple language APIs (currently Java & C#); I’m looking for a language-agnostic way for a user to specify a predicate that filters on a set of objects the exact contents of which are known only to the server process (which is written in Java).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:50:09+00:00Added an answer on June 13, 2026 at 9:50 pm

    I would give a look at MVEL. It supports expressions of the like :

    (user.name == 'John Doe') && ((x * 2) - 1) > 20

    Used it once on a project to express some basic business rules from a client.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible a lambda function to have variable number of arguments? For example,
Using boost::phoenix::function I encountered some problems. As far as I know this lazy function
Let's say I have these two tables: ParentDataItem ParentDataItemID ...some other fields... ChildDataItem ChildDataItemID
This question is related to one I asked the other day which I got
I would like some information on how to correctly think about C++11 closures and
In some situations it's desirable to be able to type-erase a callable (e.g. function,
I've got a method similar to this, which loops through one set of data
Say I have some sort of type wrapping up a function, maybe a lambda
Ok I have some code that boils down to a pattern like this class
Apparently I upgraded my Firefox this morning along with some other system updates and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.