determine if an Object is of primitive type

This commit is contained in:
joe zhang 2020-07-30 21:15:06 +08:00
parent f29c757e18
commit 6e43adc107
2 changed files with 4 additions and 4 deletions

View File

@ -23,7 +23,7 @@ public class PrimitiveTypeUtil {
WRAPPER_TYPE_MAP.put(Void.class, void.class);
}
public boolean isPrimitiveTypeByCommansLang(Object source) {
public boolean isPrimitiveTypeByCommonsLang(Object source) {
return ClassUtils.isPrimitiveOrWrapper(source.getClass());
}

View File

@ -27,9 +27,9 @@ public class PrimitiveTypeUtilTest {
@Test
public void givenObjectWhenCheckWithCommonsLangShouldValidate() {
assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommansLang(booleanVal));
assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommansLang(longWrapper));
assertFalse(primitiveTypeUtil.isPrimitiveTypeByCommansLang(nonPrimitiveVal));
assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(booleanVal));
assertTrue(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(longWrapper));
assertFalse(primitiveTypeUtil.isPrimitiveTypeByCommonsLang(nonPrimitiveVal));
}
@Test