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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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 learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

691 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