private Method findToStringMethod(Class<?> cls){
  Method matched=null;
  Class<?> loopCls=cls;
  while (loopCls != null && matched == null) {
    Method[] methods=loopCls.getDeclaredMethods();
    for (    Method method : methods) {
      ToString toString=method.getAnnotation(ToString.class);
      if (toString != null) {
        if (matched != null) {
          throw new IllegalStateException("Two methods are annotated with @ToString");
        }
        matched=method;
      }
    }
    loopCls=loopCls.getSuperclass();
  }
  return matched;
}

private Method findToStringMethod ( Class < ? > cls ) { Method matched = null ; Class < ? > loopCls = cls ; while ( loopCls != null && matched == null ) { Method [ ] methods = loopCls . getDeclaredMethods ( ) ; for ( Method method : methods ) { ToString toString = method . getAnnotation ( ToString . class ) ; if ( toString != null ) { if ( matched != null ) { throw new IllegalStateException ( "Two methods are annotated with @ToString" ) ; } matched = method ; } } loopCls = loopCls . getSuperclass ( ) ; } return matched ; }
finds the conversion method .
