Comments Extractions

Posted on 2001-06-14
Last Modified: 2010-03-31

I have a problem wanna want to solve.........

I want to extract the comments about a method in a class just like java doc does.

 like  i have a method

/** here are comments about the methos
*@param   int
*@return  int


public int myMethod(int a){

 return a;

now i have got the class name and method name and other informations using the java.lang.reflection package but i also want to extract its comments or u can say descriptions but how............. a big queston for me...

Now its upto u that u sove my problem....

Question by:nandini_kumar
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 92

Accepted Solution

objects earned 100 total points
ID: 6189966
You can't use reflection to extract the comments that I'm aware, and anyway they may have been stripped from the class file.
But from the sound of what you're trying to do doclets are just what you need:

Expert Comment

ID: 6190632
>and anyway they may have been stripped from the class file.
They aren't "maybe stripped", they are definitely stripped :-)

You can't do that without access to the source (java) file. If you do have access, use doclets, like "objects" recommended.

Sasha Maryanovsky.

Expert Comment

by:Igor Bazarny
ID: 6192568
> They aren't "maybe stripped", they are definitely stripped :-)
Not everything, to be precise, @deprecated doc tag stored in class file :-). Don't have doc due to network problems and don't remember whether it returned by reflection.

Anyway, doclet is probaly the best choice. Some other tools could give you access to comments and source, e.g. Together Control Center (AKA Together/J) provides such API. Don't know other examples.

Igor Bazarny
Brainbench MVP for Java 1
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now


Expert Comment

ID: 6192712
>Not everything, to be precise, @deprecated doc tag stored in class file :-).
Correct, but to be even more precise, it's stored as an optional field.

Sasha Maryanovsky.

Expert Comment

ID: 6198420
Hello nandini_kumar,

You have a number of old open questions with comments you have not responded to.  Would you please resolve
those open questions before you ask the experts to provide you with additional free services.

Community Support Moderator
LVL 14

Expert Comment

ID: 8950434

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

--  points to objects

Please leave any comments here within the next seven days.
EE Cleanup Volunteer
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 243
spring maven example issues 3 45
Java class and jar 3 43
Bitwise and to sum elements 2 17
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question