determine if an Object is of primitive type
This commit is contained in:
+1
-1
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user