public static final Class getArgClass ( Object arg ) { if ( arg == null ) return null ; Class c = arg . getClass ( ) ; if ( c == Boolean . class ) return Boolean . TYPE ; else if ( c . getSuperclass ( ) == Number . class ) { if ( c == Integer . class ) return Integer . TYPE ; if ( c == Double . class ) return Double . TYPE ; if ( c == Byte . class ) return Byte . TYPE ; if ( c == Long . class ) return Long . TYPE ; if ( c == Float . class ) return Float . TYPE ; if ( c == Short . class ) return Short . TYPE ; } else if ( c == Character . class ) return Character . TYPE ; return c ; }
Gets the class for a method argument that is appropriate for looking up methods by reflection by looking for the standard primitive wrapper classes and exchanging for them their underlying primitive class objects . Other classes are passed through unchanged .