how exam presumably slight relapse form matches list<string>


what easiest proceed exam (using reflection), presumably given slight (i.e. java.lang.method instance) relapse type, safely casted list<string>?



consider snippet:



public stationary category stringlist extends arraylist<string> {}

public list<string> method1();
public arraylist<string> method2();
public stringlist method3();


all methods 1, 2, 3 perform requirement. it's definitely easy exam method1 (via getgenericreturntype(), advantage instance parameterizedtype), nonetheless methods2 3, it's obvious. i imagine, traversing getgenericsuperclass() getgenericinterfaces(), definitely close, nonetheless i don't see, review typevariable list<e> (which occurs somewhere superclass interfaces) tangible form parameter (i.e. where e matched string).



or maybe there totally opposite (easier) way, i overlook?



edit: those looking it, here method4, also fulfills requirement shows some-more cases, have investigated:



public interface parametrized<t extends stringlist> {
t method4();
}


Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

using mvc, should hoop communication between views? between models?