Post

MyBatis Apache Commons를 이용하여 null 체크

1. String null 체크

1) dependency 추가

1
2
3
4
5
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.12.0</version>
</dependency>

2) 활용

1
2
<if test="@org.apache.commons.lang3.StringUtils@isNotBlank(param)">
</if>

2. List null 체크

1) dependency 추가

1
2
3
4
5
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-collections4</artifactId>
    <version>4.4</version>
</dependency>

2) 활용

1
2
<if test="@org.apache.commons.collections4.CollectionUtils@isNotEmpty(paramList)">
</if>

[출처 및 참고]

This post is licensed under CC BY 4.0 by the author.