public static String getAsParametricType(Type type) {
		String result = null;
		if(isSimple(type)) {
			result = ((Class<?>)type).getCanonicalName();
		} else if(isGeneric(type)) {
			StringBuilder buffer = new StringBuilder();
			ParameterizedType container = (ParameterizedType)type ;
			String containerType = ((Class<?>)container.getRawType()).getCanonicalName();
			buffer.append(containerType).append("<");
			// now grab the names of all generic types (those within <...>)
			Type[] generics = container.getActualTypeArguments();
			for(int i = 0; i < generics.length; ++i) {
				buffer.append(i == 0 ? "" : ", ").append("?");
			}
			buffer.append(">");
			result = buffer.toString();			
		}
		return result;
	}
public static String getAsParametricType ( Type type ) { String result = null ; if ( isSimple ( type ) ) { result = ( ( Class < ? > ) type ) . getCanonicalName ( ) ; } else if ( isGeneric ( type ) ) { StringBuilder buffer = new StringBuilder ( ) ; ParameterizedType container = ( ParameterizedType ) type ; String containerType = ( ( Class < ? > ) container . getRawType ( ) ) . getCanonicalName ( ) ; buffer . append ( containerType ) . append ( "<" ) ; Type [ ] generics = container . getActualTypeArguments ( ) ; for ( int i = 0 ; i < generics . length ; ++ i ) { buffer . append ( i == 0 ? "" : ", " ) . append ( "?" ) ; } buffer . append ( ">" ) ; result = buffer . toString ( ) ; } return result ; }
Returns the string representation of a type; all class names are fully
qualified, and generic containers have a question mark for each parametric
type ((e.g. Map&lt;?, ?&gt;).

@param type
the type to describe.
@return
a textual description of the type ((e.g. Map&lt;?, ?&gt;)..