66import com .googlecode .totallylazy .Sequence ;
77import com .googlecode .yadic .ContainerException ;
88import com .googlecode .yadic .Resolver ;
9- import com .googlecode .yadic .generics .Types ;
109
1110import java .lang .reflect .Method ;
1211import java .lang .reflect .Type ;
1312import java .util .ArrayList ;
1413import java .util .List ;
1514
1615import static com .googlecode .totallylazy .Arrays .exists ;
16+ import static com .googlecode .totallylazy .Callables .ascending ;
1717import static com .googlecode .totallylazy .Callables .cast ;
1818import static com .googlecode .totallylazy .Callables .descending ;
1919import static com .googlecode .totallylazy .Methods .genericParameterTypes ;
2020import static com .googlecode .totallylazy .Methods .genericReturnType ;
21+ import static com .googlecode .totallylazy .Methods .methodName ;
2122import static com .googlecode .totallylazy .Methods .modifier ;
2223import static com .googlecode .totallylazy .Option .none ;
2324import static com .googlecode .totallylazy .Option .some ;
2425import static com .googlecode .totallylazy .Predicates .not ;
2526import static com .googlecode .totallylazy .Predicates .where ;
2627import static com .googlecode .totallylazy .Sequences .sequence ;
28+ import static com .googlecode .totallylazy .comparators .Comparators .comparators ;
2729import static com .googlecode .yadic .generics .TypeConverter .convertParametersToInstances ;
2830import static com .googlecode .yadic .generics .Types .classOf ;
2931import static com .googlecode .yadic .generics .Types .matches ;
@@ -50,7 +52,7 @@ public T resolve(Type type) throws Exception {
5052 filter (modifier (PUBLIC ).and (modifier (STATIC )).
5153 and (where (genericReturnType (), matches (type )).
5254 and (where (genericParameterTypes (), not (exists (matches (type ))))))).
53- sortBy (descending (arity ()));
55+ sortBy (comparators ( descending (arity ()), ascending ( methodName () )));
5456
5557 if (methods .isEmpty ()) {
5658 throw new ContainerException (concreteClass .getName () + " does not have any public static methods that return " + type );
0 commit comments