Please have a look on the scenario and suggest how can I remove the following issue.
-
We have an interface BaseRepository which is already build in having a method commitData(), retrieveData(), sortByLength().
public interface BaseRepository{ public void commitData(); public Object retrieveData(); public Object sortByLength(); }
-
Interface FileRepository which extends BaseRepository having methods commitData(), fileNames() i.e.
public interface FileRepository extends BaseRepository{ public void commitData(); public List fileNames(); }
-
Interface ObjectRepository which extends both BaseRepository and FileRepository with no methods in it.
-
Using Java Reflection API I try to get the methods define in the Interfaces for further processing, but getting method commitData 2 times i.e. following piece of code will give me 2 time commitData in the console
for(Method method : ObjectRepository.class.getMethods()){ System.out.println(method.getName()); }
output is:
commitData retrieveData sortByLength commitData fileNames
I am using Java 1.6.
Aucun commentaire:
Enregistrer un commentaire