aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes How to Identify class implementing an Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How to Identify class implementing an Interface" Watch "How to Identify class implementing an Interface" New topic
Author

How to Identify class implementing an Interface

Varshini Priya
Ranch Hand

Joined: Feb 17, 2008
Posts: 93

Hi All,

I have a Query regarding the classes that implement an interface. Is there any easy method to identify the classes that are implementing an interface? I use ecllipse as the editor. Is there any shortcut keys available to get this information.

Thanks in Advance
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Is that any use to you?

[edit]Add 3rd print statement[/edit]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14433
    
  23

You mean that you just want to see in the IDE which classes implement an interface?

Put the cursor on the name of the interface and press F4 (Open Type Hierarchy). That will open a window that shows a tree with all classes that Eclipse can find that implement the interface.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Varshini Priya
Ranch Hand

Joined: Feb 17, 2008
Posts: 93

Thanks Campbell for the below.

I donot have the option to print. Using Editors like ecllipse, is there any short cut available to check the same.

Thanks in Advance
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

In Eclipse, you can select the interface name, right-click and select Open Type Hierarchy. That will show you, in the current project, the classes that implement the interface.

As a general solution, however, that does not always work because often the implementation class used at runtime is in some other component/project. The thing that has worked best for me is to use the debugger to determine the class of the object, or to print the object.getClass() value.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Identify class implementing an Interface