Skip to content

Commit dd0e731

Browse files
committed
Support coercion of numeric types to boolean.
1 parent 43bc794 commit dd0e731

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
subprojects {
1616
group = 'org.httprpc'
17-
version = '8.3.2'
17+
version = '8.3.3'
1818

1919
apply plugin: 'java-library'
2020
apply plugin: 'maven-publish'

httprpc-client/src/main/java/org/httprpc/beans/BeanAdapter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,8 @@ private static Object adaptValue(Object value, Class<?> type) {
579579
} else if (type == Boolean.TYPE || type == Boolean.class) {
580580
if (value == null) {
581581
return (type == Boolean.TYPE) ? Boolean.FALSE : null;
582+
} else if (value instanceof Number) {
583+
return ((Number)value).longValue() != 0;
582584
} else {
583585
return Boolean.parseBoolean(value.toString());
584586
}

0 commit comments

Comments
 (0)