private static String canonizeTypeString(String str){
  String canon=str.trim();
  canon=canon.replaceAll("\\s+"," ");
  canon=canon.replaceAll("\\[\\s+","[");
  canon=canon.replaceAll("\\s+\\]","]");
  canon=canon.replaceAll("<\\s+","<");
  canon=canon.replaceAll("\\s+>",">");
  canon=canon.replaceAll("[^\\<]*\\.(?=\\w)","");
  return canon;
}

private static String canonizeTypeString ( String str ) { String canon = str . trim ( ) ; canon = canon . replaceAll ( "\\s+" , " " ) ; canon = canon . replaceAll ( "\\[\\s+" , "[" ) ; canon = canon . replaceAll ( "\\s+\\]" , "]" ) ; canon = canon . replaceAll ( "<\\s+" , "<" ) ; canon = canon . replaceAll ( "\\s+>" , ">" ) ; canon = canon . replaceAll ( "[^\\<]*\\.(?=\\w)" , "" ) ; return canon ; }
a method to canonize type string representation . it removes any unnecessary white spaces and finds the type simple name instead of the fully qualified name .
