相关文章推荐
忐忑的眼镜  ·  python-try-except:pass ...·  2 年前    · 
体贴的弓箭  ·  Jmeter: ...·  2 年前    · 
大方的鼠标  ·  在 .NET Core 中结合 ...·  2 年前    · 
谦和的马克杯  ·  javascript - How can ...·  2 年前    · 

request for change "IllegalArgumentException: eq(null) is not allowed. Use isNull() instead" #3059

@jiayp

Description

There is a same request #25 ,but I have a deffrent reason.

Why the new feature should be added

My project has many search conditions, and has many code like this:

    BooleanBuilder builder = new BooleanBuilder();
    if (!ObjectUtils.isEmpty(likeName)) {
      builder.and(QUser.user.name.like(("%" + likeName+ "%")));
    if (!ObjectUtils.isEmpty(age)) {
      builder.and(QUser.user.age.eq(age));

I want to impove it, So I and a function to check is the param is exists and then add it .I want code like this

    TryBooleanBuilder builder = new TryBooleanBuilder();
    builder
        .tryAnd(likeName, QUser.user.name.like(("%" + likeName+ "%")))
        .tryAnd(age, QUser.user.id.eq(age));

Then "IllegalArgumentException: eq(null) is not allowed. Use isNull() instead" is appeared.

How the new feature should work

Maybe add a config to ignore the exception?