添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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?