static Set < Method > findCandidateMethods ( Class < ? > [ ] classes , String name ) { StringBuilder sb = new StringBuilder ( ) ; for ( Class < ? > clazz : classes ) { sb . append ( clazz . getName ( ) ) . append ( "::" ) ; } String cacheKey = sb . append ( name ) . toString ( ) ; if ( methodCache . containsKey ( cacheKey ) ) { return methodCache . get ( cacheKey ) ; } Set < Method > methods = new HashSet <> ( ) ; for ( Class < ? > clazz : classes ) { for ( Method method : clazz . getMethods ( ) ) { if ( method . isAnnotationPresent ( JsonRpcMethod . class ) ) { JsonRpcMethod methodAnnotation = method . getAnnotation ( JsonRpcMethod . class ) ; if ( methodAnnotation . required ( ) ) { if ( methodAnnotation . value ( ) . equals ( name ) ) { methods . add ( method ) ; } } else if ( methodAnnotation . value ( ) . equals ( name ) || method . getName ( ) . equals ( name ) ) { methods . add ( method ) ; } } else if ( method . getName ( ) . equals ( name ) ) { methods . add ( method ) ; } } } methods = Collections . unmodifiableSet ( methods ) ; methodCache . put ( cacheKey , methods ) ; return methods ; }
Finds methods with the given name on the given class .