Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Checks if object is auto-boxed primitive + String and Void
public boolean isWiderPrimitive(Object object) {
if (object == null) {
return false;
}
Class clazz = object.getClass();
if (clazz == Boolean.class || clazz == Character.class ||
clazz == Byte.class || clazz == Short.class ||
clazz == Integer.class || clazz == Long.class ||
clazz == Float.class || clazz == Double.class ||
clazz == String.class || clazz == Void.class) {
return true;
}
return false;
}
@LenarBad

This comment has been minimized.

Copy link
Owner Author

@LenarBad LenarBad commented Jul 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment