Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Associating and using javadoc comments with java elements.

Reply
Thread Tools

Associating and using javadoc comments with java elements.

 
 
sude
Guest
Posts: n/a
 
      02-15-2006
Hi!,
I need a way to associate a javadoc comment with the corresponding
Java Element. And access that programmatically in Java.
e.g. For the code below
/**
* This is my Class
*/
public class X {

}

I need something like
<sometype> myJavaElement = <something which gives class X>
myJavaElement.getComment();


One way which I was thinking of was using the AntLR and modifying the
lexer code generated by the AntLR. But was wondering that this problem
might (should ) have been faced by other people and if there exists
an open source tool which can be used for this purpose.
I looked at qdox but that I guess will not be able to handle package
level comments which is a basic requirement for me.

Any help is highly appreciated and highly awaited.

Thanks a lot,
Sudhanshu

 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      02-15-2006
On 14 Feb 2006 16:59:20 -0800, "sude" <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

>One way which I was thinking of was using the AntLR and modifying the
>lexer code generated by the AntLR. But was wondering that this problem
>might (should =EF=81=8A) have been faced by other people and if there exists
>an open source tool which can be used for this purpose.
>I looked at qdox but that I guess will not be able to handle package
>level comments which is a basic requirement for me.


I don't follow why you are doing this or what precisely you are
tracking. However, there are two techniques in general for tackling
this sort of problem.

1. annotations:

2. custom Javadoc comments you handle with a custom Doclet to generate
the HTML or other summaries.

See http://mindprod.com/jgloss/annotations.html
http://mindprod.com/jgloss/javadoc.html

--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
 
 
 
Owen Jacobson
Guest
Posts: n/a
 
      02-15-2006
On Tue, 14 Feb 2006 16:59:20 -0800, sude wrote:

> Hi!,
> I need a way to associate a javadoc comment with the corresponding
> Java Element. And access that programmatically in Java.


Comments (including "javadoc comments") are not retained by the compiler.
End of story. If you need some descriptive information about a class at
runtime, either store it in an annotation with runtime retention or create
a lookup table mapping symbols (class names, packages, class member names,
et cetera) to the information you need and access that.
 
Reply With Quote
 
Richard Wheeldon
Guest
Posts: n/a
 
      02-15-2006
sude wrote:
> I need a way to associate a javadoc comment with the corresponding
> Java Element. And access that programmatically in Java.


Use a custom doclet, write <method,comment> pairs to some output file.
Read them back as required,

Richard
 
Reply With Quote
 
sude
Guest
Posts: n/a
 
      02-25-2006
Well this requires an assumption on my part that the comments that are
provided in the java code are given through a java doc tag. Right? But
I do not want to impose any such restriction to the user. In my opinion
JDT would need to solve this problem to show the javadoc comment
associated with any element.
Am not sure if they have any lean/minimal component to solve this.
Anybody has any idea?

sudhanshu

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Canonical ordering of javadoc comments Roedy Green Java 2 05-05-2009 01:27 PM
recording audio while viewing photos and associating the two files? gaikokujinkyofusho@gmail.com Digital Photography 9 12-28-2006 12:12 AM
Generate Java code with javadoc comments using Castor veerleverbr@hotmail.com Java 0 07-07-2005 07:57 AM
Write web controls out to a page and associating event handlers =?Utf-8?B?Tm92aWNl?= ASP .Net 1 09-23-2004 06:31 PM
Help with finding datagrid and associating event News ASP .Net 4 07-20-2004 03:19 PM



Advertisments