Solved

Comments Extractions

Posted on 2001-06-14
6
205 Views
Last Modified: 2010-03-31
Hi

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....

                                   Nandini
0
Comment
Question by:nandini_kumar
6 Comments
 
LVL 92

Accepted Solution

by:
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:
http://java.sun.com/products/jdk/1.2/docs/tooldocs/javadoc/overview.html
0
 
LVL 7

Expert Comment

by:Sasha_Mapa
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.
0
 
LVL 7

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.

Regards,
Igor Bazarny
Brainbench MVP for Java 1
www.brainbench.com
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 7

Expert Comment

by:Sasha_Mapa
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.
0
 

Expert Comment

by:teacher_mod
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.

teacher_mod
Community Support Moderator
Experts-Exchange
teacher_mod@experts-exchange.com
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
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.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
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.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Groovy problem when using SOAPUI : DispatchException occurred 7 58
factorial example 4 47
reverse digits of a number using for loop 5 52
Tagging and Merging on Branch 1 29
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

856 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