Skip to content

Commit bb6d96c

Browse files
committed
remove commons-lang3 and replace isEmpty checks
1 parent 284044c commit bb6d96c

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5555

5656
<beanmapper.version>6.0.0</beanmapper.version>
57-
<commons.lang.version>3.18.0</commons.lang.version>
5857
<el.api.version>6.0.1</el.api.version>
5958
<el.impl.version>4.0.2</el.impl.version>
6059
<guava.version>33.3.1-jre</guava.version>
@@ -94,11 +93,6 @@
9493
<artifactId>guava</artifactId>
9594
<version>${guava.version}</version>
9695
</dependency>
97-
<dependency>
98-
<groupId>org.apache.commons</groupId>
99-
<artifactId>commons-lang3</artifactId>
100-
<version>${commons.lang.version}</version>
101-
</dependency>
10296

10397
<!-- Spring integration -->
10498
<dependency>

src/main/java/io/beanmapper/spring/util/JsonUtil.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import java.util.Iterator;
55
import java.util.Set;
66

7-
import org.apache.commons.lang3.StringUtils;
8-
97
import com.fasterxml.jackson.core.JsonProcessingException;
108
import com.fasterxml.jackson.databind.JsonNode;
119
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -17,10 +15,10 @@
1715
* @since Nov 13, 2015
1816
*/
1917
public class JsonUtil {
20-
18+
2119
/**
2220
* Retrieve the property names mentioned in a JSON content.
23-
*
21+
*
2422
* @param json the JSON content
2523
* @param objectMapper the object mapper
2624
* @return set of the property names
@@ -33,17 +31,21 @@ public static Set<String> getPropertyNamesFromJson(String json, ObjectMapper obj
3331
throw new IllegalStateException("Could not retrieve property names from JSON.", e);
3432
}
3533
}
36-
34+
3735
private static Set<String> getPropertyNames(JsonNode node, String base) {
3836
Set<String> propertyNames = new HashSet<>();
3937
Iterator<String> iterator = node.fieldNames();
4038
while (iterator.hasNext()) {
4139
String fieldName = iterator.next();
42-
String propertyName = StringUtils.isEmpty(base) ? fieldName : base + "." + fieldName;
40+
41+
String propertyName = isEmpty(base) ? fieldName : base + "." + fieldName;
4342
propertyNames.add(propertyName);
4443
propertyNames.addAll(getPropertyNames(node.get(fieldName), propertyName));
4544
}
4645
return propertyNames;
4746
}
4847

49-
}
48+
private static boolean isEmpty(String str) {
49+
return str == null || str.isEmpty();
50+
}
51+
}

src/main/java/io/beanmapper/spring/web/MergedFormMethodArgumentResolver.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import io.beanmapper.spring.Lazy;
1616
import io.beanmapper.spring.web.converter.StructuredBody;
1717

18-
import org.apache.commons.lang3.StringUtils;
1918
import org.slf4j.Logger;
2019
import org.slf4j.LoggerFactory;
2120
import org.springframework.context.ApplicationContext;
@@ -134,7 +133,7 @@ private void validateObject(WebRequestParameters webRequestParameters, Object ob
134133
}
135134

136135
private Long resolveId(NativeWebRequest webRequest, String mergeId) {
137-
if (StringUtils.isEmpty(mergeId)) {
136+
if(mergeId == null || mergeId.isEmpty()) {
138137
return null;
139138
}
140139

0 commit comments

Comments
 (0)