public static Method getCallableFactoryForParams ( final Class < ? > type , final Class < ? > ... params ) { for ( Method m : type . getMethods ( ) ) { if ( ( m . getModifiers ( ) & PUBLIC_STATIC_MODIFIER ) != PUBLIC_STATIC_MODIFIER ) { continue ; } if ( ! type . isAssignableFrom ( m . getReturnType ( ) ) ) { continue ; } if ( ! Arrays . equals ( m . getParameterTypes ( ) , params ) ) { continue ; } if ( ! VALID_FACTORY_METHOD_NAMES . matcher ( m . getName ( ) ) . matches ( ) ) { continue ; } return m ; } return null ; }
Search for a static factory method returning the target type .