Re: Re: getting all the interfaces for a class

Rajaraman Santhanam <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <12baf93f9d5.-6058656049368394074.-9215712719127738134@zohocorp.com>
No, my need is nothing to do with loaded classes. Sorry I am not clear with my question.

Consider the below code implementation in the target java application.


public interface A
{
public void a(int i);


public void a1(int j);
}

 public class B implements A
{
      public void a(int i)
      {
            System.out.println(i);
      }


      public void a1(int j)

      {
            System.out.println(j);
      }
}

 public class C extends B
{
      public void a(int i)
      {
            System.out.println(++i);
      }



}


 

Lets say, my need is to instrument all the methods of the classes that are of type "A". How would I know in the ClassReader level that class C is of type B &amp; A also??

thanks,
ramanr

---- On Fri, 15 Oct 2010 13:14:34 +0530 Rémi Forax &lt;[email protected]&gt; wrote ---- 

 Le 15/10/2010 09:23, Rajaraman Santhanam a écrit :   I would like to know the best solution to find out all the classes that implement an interface either directly or indirectly (by implementing the super interface of that interface or extending a class that implements that interface).
 
 
 One way is the ClassFileTransformer implementation should keep track of the interfaces extending that interface and class that implements that interface.  Any easier solution to achieve this?
 
 
  
 There is no simple solution.
 
 I suppose you want only loaded classes not all existing classes (whatever it means).
 You can also use Instrumentation.getAllLoadedClasses()
 
   thanks,
 ramanr
 
  
 Rémi
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.