How to implement <isEmpty> easily in mybatis?

Viewed 541

In ibatis2.X it used to be:

<isEmpty property="userName" >

In MyBatis now it is something like:

<if test="userName != null && userName.trim().length !=0 " > 

I would like to find an easy alternative to isEmpty in MyBatis. I found I can also use this construct:

<if test="@org.apache.commons.StringUtils@isEmpty(userName)" >

But it is not very convenient either.

Maybe I am missing something and there is <isEmpty> in MyBatis, or even something like <if test="isEmpty(userName)" > would be good enough. Could you advice?

0 Answers
Related