private static Type getType ( final char [ ] buf , final int off ) { int len ; switch ( buf [ off ] ) { case ' ' : return VOID_TYPE ; case ' ' : return BOOLEAN_TYPE ; case ' ' : return CHAR_TYPE ; case ' ' : return BYTE_TYPE ; case ' ' : return SHORT_TYPE ; case ' ' : return INT_TYPE ; case ' ' : return FLOAT_TYPE ; case ' ' : return LONG_TYPE ; case ' ' : return DOUBLE_TYPE ; case ' ' : len = 1 ; while ( buf [ off + len ] == ' ' ) { ++ len ; } if ( buf [ off + len ] == ' ' ) { ++ len ; while ( buf [ off + len ] != ' ' ) { ++ len ; } } return new Type ( ARRAY , buf , off , len + 1 ) ; case ' ' : len = 1 ; while ( buf [ off + len ] != ' ' ) { ++ len ; } return new Type ( OBJECT , buf , off + 1 , len - 1 ) ; // case '(': default : return new Type ( METHOD , buf , off , buf . length - off ) ; } }
Returns the Java type corresponding to the given type descriptor . For method descriptors buf is supposed to contain nothing more than the descriptor itself .