public Class < ? > box ( Class < ? > primitive ) { if ( ! primitive . isPrimitive ( ) ) { return primitive ; } if ( int . class . equals ( primitive ) ) { return Integer . class ; } else if ( long . class . equals ( primitive ) ) { return Long . class ; } else if ( float . class . equals ( primitive ) ) { return Float . class ; } else if ( double . class . equals ( primitive ) ) { return Double . class ; } else if ( short . class . equals ( primitive ) ) { return Short . class ; } else if ( boolean . class . equals ( primitive ) ) { return Boolean . class ; } else if ( char . class . equals ( primitive ) ) { return Character . class ; } else if ( byte . class . equals ( primitive ) ) { return Byte . class ; } throw new IllegalArgumentException ( "Unknown primitive type " + primitive ) ; }
A helper boxing method . Returns boxed class for a primitive class