Solved

Comments Extractions

Posted on 2001-06-14
6
202 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now