determine if an Object is of primitive type
This commit is contained in:
parent
f29c757e18
commit
6e43adc107
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue