?
Solved

Comments Extractions

Posted on 2001-06-14
6
Medium Priority
?
208 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
[X]
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
6 Comments
 
LVL 92

Accepted Solution

by:
objects earned 400 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
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!

 
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 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