aspose file tools*
The moose likes Beginning Java and the fly likes Getting Java class (public) fields and methods without API ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Getting Java class (public) fields and methods without API ? " Watch "Getting Java class (public) fields and methods without API ? " New topic
Author

Getting Java class (public) fields and methods without API ?

justin smythhe
Ranch Hand

Joined: Jul 06, 2012
Posts: 107
Is it possible to see the public methods and fields of a class without using API/docs ?
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
The public fields of a class you've written? Of course. Most core Java or 3rd party API classes would not have public fields, so I'm not sure what you're asking. Can you give an example of a class you have in mind?


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

Greg: Technically, constants are public fields (and static/final) in a class you didn't write.

Justin: If you view the class in an IDE, you should be able to see this information. For example, in Eclipse, you do open type on that class and the outline view shows you all the fields and methods. Public and private for that matter.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 557
Greg: Technically, constants are public fields (and static/final) in a class you didn't write.

Absolutely. I didn't interpret the OP's question to be about constants, but you're absolutely right to include that in the answer space. Thanks for widening my thinking.
justin smythhe
Ranch Hand

Joined: Jul 06, 2012
Posts: 107
Jeanne Boyarsky wrote:Greg: Technically, constants are public fields (and static/final) in a class you didn't write.

Justin: If you view the class in an IDE, you should be able to see this information. For example, in Eclipse, you do open type on that class and the outline view shows you all the fields and methods. Public and private for that matter.


Thanks ! This is what it is like
How can I also see ALL the fields (including inherited) & methods of any Class used in my java code in eclipse ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38334
    
  23
Do you mean how to program something which shows all the fields in a class, or how to get an IDE like Eclipse to display them? For the former, you can try reflection. For an IDE, don’t you get views and perspectives which show all the class members. In Eclipse you get little icons of different colours: green for public, yellow for protected, blue for package private and red for private (I think). Doesn’t the help page you quoted tell you how to display them?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Java class (public) fields and methods without API ?